File upload is not working with AsyncPostBackTrigger in ASP.Net

最后都变了- 提交于 2019-12-11 12:42:06

问题


I have one html file upload control to upload the profile picture and I'm using update panel and AsyncPostBackTrigger trigger. If I use PostBackTrigger then uploading of profile image works but If I use AsyncPostBackTrigger then uploading doesn't work.

Below is my code inline:

<asp:UpdatePanel ID="pnlZerkerBasicProfile" runat="server">
<input type="file" id="myFile" name="myFile" class="file_input_hidden" onchange="javascript:FileUploadSubmit();" style="cursor: pointer;" />
<Triggers>
        <asp:AsyncPostBackTrigger ControlID="btnSaveProfilePicture" />
</Triggers>
</asp:UpdatePanel>

Can anyone help?


回答1:


This is a known issue, a full postback is required for the fileupload control to work within an updatepanel i.e. you can't use a AsyncPostBackTrigger.

Edit: Just saw this is a duplicate of FileUpload Doesn't Work When Nested In UpdatePanel? C#



来源:https://stackoverflow.com/questions/18126010/file-upload-is-not-working-with-asyncpostbacktrigger-in-asp-net

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!