Child Fileupload control postback data RRS feed

  • Question

  • User1092066457 posted

    Hello, I am looking for a little direction with a custom control.  I will try and include only the relevant portions so I can highlight the area I am having difficulties with


    I am attempting to make a composite control called FileList that can be used to manage the files in a folder (think email attachments)

    Filelist has several child controls, the relevant ones are:_file as FileUpload,_button as Button


    The intent is to catch the _button.click event and call _file.saveas to some directory

    inside FileList.vb, I created a sub to handle _button.click, and this fires on the click normally, but _file.hasfiles is false.  I notice that createchildcontrols is creating a new _file each postback before the click event is handled

     I have found some similar posts, and an example of how to implement ipostbackdatahandler, but I am still unclear about how to put it all together.  The example seems to be sticking a string in viewstate and reading it from postCollection(postDataKey) blindly.
    How would I do something equivalent with a fileUpload's data? Do I need to stick my _file into the viewstate?


    I suspect I am missing something and there is an easier way to do this.  Thanks,





    Tuesday, March 18, 2008 2:59 PM


  • User1092066457 posted

    Just following up...I got it working.  It was in an update panel which does not allow file uploads :/  Hopefully this lesson in frustration helps someone else

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, March 19, 2008 12:41 PM