FileUpload and UpdatePanel: ScriptManager.RegisterPostBackControl works the second time

前端 未结 6 1823
你的背包
你的背包 2020-12-16 23:19

I\'m developing an ASP.NET application with C# and Visual Studio 2008 SP1. I\'m using WebForms.

I have an ASPX page with two UpdatePanels, one on the left that holds

6条回答
  •  庸人自扰
    2020-12-16 23:39

    I had to combine both advices here. I am using an UpdatePanel to dynamically load an UserControl and the FileUpload is in the UserControl. I had to:

    • RegisterPostBackControl in the user control's Page_Load

    • add enctype="multipart/form-data" to the form element of the page, which contains the update panel, the code Page.Form.Attributes.Add("enctype", "multipart/form-data"); didn't work for me, it had to be in the aspx

    Hope this helps.

提交回复
热议问题