Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
60
WebUpload ViewState on Postback of WebUpload
posted

My app provides a view of validated items from the uploaded files.

I need to bind a grid/listview after files uploaded but when I do it after the uploadfinished event its too late.

If I do a postback to the existing page I lose the list of files in the upload view.

Suggestions?

Parents
No Data
Reply
  • 17590
    Offline posted

    Hello Daniel,

    Thank you for posting in the community.

    What I can suggest for achieving your requirement is to use __doPostBack function to trigger a postback once FileUploading client-side event is fired. The __doPostBack function takes two arguments, eventTarget and eventArgument. The eventTarget contains the ID of the control that causes tha postback and eventArguments contains any additional data associated with the control(some further reference about __doPostBack function could be found at:  http://aspalliance.com/articleViewer.aspx?aId=895&pId=-1 ).

    In your scenario what could be done is to trigger a postback when FileUploading event is fired. Afterwards in the PageLoad event of the page it could be checked whether the eventArgument from the __doPostBack is the same that is set for the FileUploading event and if so rebind the grid. For example:

    client-side:

    WebUpload1_FileUploading(eventArgs, infoObject)

    {

    __doPostBack("up1", "fileUploaded");

    }

    code-behind:

    protected void Page_Load(object sender, EventArgs e)

    {

       if (Request["__EVENTARGUMENT"] == "fileUploaded")

    {

                //bind your control here

    }

     

    I hope you find this information helpful.

    Please do not hesitate to contact me if you have any additional questions regarding this matter.

     

Children