The real napster
The real napster

Reputation: 2324

ASP.NET Fileupload and AJAX

I have a little problem with the FileUpload and uploadpanels.

As most of you probably knows you cannot use the asp:FileUpload control without forcing a postback. At least not what I know of, let me know if I am wrong.

Now my problem is: I have a usercontrol with a FileUpload and a button that says "Upload". This UserControl is loaded into a UpdatePanel. Now I want to register to the upload button inside the usercontrol as a postback trigger. Is there any way to do this?

Does anyone know of a way to make fileuploads without postbacks?

Best Regards The real napster

Upvotes: 2

Views: 1248

Answers (2)

The real napster
The real napster

Reputation: 2324

Solved this issue

If anyone meets this challenge it can be solved by doing this in your UserControl

ScriptManager sman = ScriptManager.GetCurrent(Page);
sman.RegisterPostBackControl(btn_addDocument);

Upvotes: 2

pmarflee
pmarflee

Reputation: 3428

You need to add a trigger to your UpdatePanel control to force the button that submits the page to perform a full postback. An example would be:

<triggers>
        <asp:postbacktrigger controlid="btnSave" />
</triggers>

Upvotes: 0

Related Questions