2

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

2 Answers 2

2

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);
Sign up to request clarification or add additional context in comments.

Comments

0

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>

1 Comment

Yes I understand that but the btnSave is inside the UserControl and I dont want the rest of the buttons in the UserControl to perform a postback. I cannot add btnSave as a trigger as it is not there runtime.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.