views:

35

answers:

2

i am doing Fileupload using asp.net 3.5 with asp.net ajax.In that i am using Usercontrol MainPage.ascx Page:In this page i am using UpdatePanel inside Fileupload control. Demo.aspx:In this page also i am using Updatepanel. i am drag MainPage.ascx usercontrol inside this UpdatePanel which is in Demo.aspx.

Question: When i drag the Mainpage.ascx Usercontrol on Demo.aspx . Here i am getting the Fileupload.HasFile is getting null .If anybody knows Plz.

Please do the needfull.

+1  A: 

You need to add a PostBackTrigger for your UploadControl because it is inside an update panel. (Maybe you need an AsyncPostBackTrigger)

citronas
The PostbackTrigger would have to be on the button that submits the form and updates the data in the UpdatePanel, not the FileUpload itself. Note that the UpdatePanel becomes useless if the only reason of it was to do that submit without a normal postback.
Willem
+1  A: 

A standard fileupload control cannot be used in an ajax-postback. You could use an AsyncFileUpload control from the ASP.NET Ajax Control Toolkit. This control can send files in an ajax-postback and has some other options that you can see in the demo.

If you use the AsyncFileUpload, make sure to use the ToolkitScriptManager from the Ajax Control Toolkit instead of the default ScriptManager.

Willem