Tuesday, December 16, 2008

Asp.net Update Panel and File upload

Got stuck when using this control in the update panel. and you got a work around by making a pop up window to download the file through it.

This is not the case here, now you can use the ordinary file upload in the update panel! the only thing you have to do is making the button that "submit" to be postback from updatepanel triggers.

< update panel>
< content template>
< /content template>
< triggers>
< ! -- here is your ascync trigger -- >
< / triggers>
< /update panel>


Note: make sure that the control in the triggers tags is visible, if you want to hide it try style="display:none;" attribute.

if you are using a master page that contains an update panel and you want to do it. you can add this line to the page load event:

ScriptManager.GetCurrent(Page).RegisterPostBackControl(Button1);

now it is fine and working properly :)
Reblog this post [with Zemanta]

No comments:

Post a Comment