1

I am using AjaxFileUpload in ASP.NET 4.0 website and I have one gridview to show the uploaded file list upon update.

I'm using AjaxFileUpload FileUploadComplete function to save uploaded file list & bind into my gridview. However, my problem is the gridview with databind doesn't showed up on the page instantly & it'll show only after postback.

Any one can advise how to trigger postback once file upload complete OR how to make my gridview updated without any postback?

Appreciate any suggestion. Thanks.

Amy
  • 101
  • 4
  • 13
  • To trigger a postback from the server, refer to [here](http://stackoverflow.com/questions/8209944/forcing-a-postback). – Amber Oct 18 '13 at 08:06
  • get the HTML of gridview after binding it as a response of your fileupload call – Ronak Patel Oct 18 '13 at 09:56
  • 1
    Postback from server code as suggested in this question http://stackoverflow.com/questions/8209944/forcing-a-postback won't work in case of AjaxFileUpload as this control submitting to hidden frame or uploading file with File API in case of modern browser. – Yuriy Rozhovetskiy Oct 21 '13 at 15:11
  • Yes, you are right. I tested forced postback but it doesn't help. Still the same. – Amy Oct 22 '13 at 01:09
  • @Amy since there are to few chances that question will be reopened I posted solution here: http://pastebin.com/jTawLzGJ – Yuriy Rozhovetskiy Oct 22 '13 at 06:00
  • Thanks, Yuriy. Now, i solved it as workaround way to use ajax collapse panel to trigger postback upon expand. – Amy Oct 24 '13 at 07:33

1 Answers1

0

Maybe you can try placing the grid in an ajax updatepanel and adding the FileUpload control's FileUploadComplete event as a trigger to the panel. That way when the event is executed the grid's updatepanel will do its own postback and update the grid.

Aaron
  • 1
  • Hi @Aaron, I tested but there is no option for me to tag the FileUploadComplete event. I can only tag FileUpload control as trigger. Any advice. Thanks. – Amy Oct 22 '13 at 03:14