【发布时间】:2010-12-14 13:05:39
【问题描述】:
我正在开发一个 ASP.Net 自定义控件。在我的控件中,我有一个 FileUpload 控件,在 MultiView 内,在 AJAX UpdatePanel 内。
我已将提交按钮添加到更新面板的回发触发器中。 (这是让 FileUpload 在 UpdatePanel 中工作的标准修复程序。
在第一次提交时,FileUpload 不会上传任何内容(即,控件的 FileBytes 属性的长度为零)。表单上的所有其他内容均正确提交。
在第二次及后续提交时,上传正常。
什么可能导致这种情况,我该如何解决?
例如:
<asp:UpdatePanel runat="server" ID="update_panel" UpdateMode="Conditional">
<ContentTemplate>
<asp:MultiView runat="server" ID="mvMultiView" ActiveViewIndex="0">
<asp:View runat="server" ID="viewOne">
<!-- content -->
</asp:View>
<asp:View runat="server" ID="viewTwo">
<!-- some other form elements -->
<asp:FileUpload ID="file_upload" runat="server" />
<asp:Button ID="save_button" runat="server" Text="Save" OnClick="save_Click" ValidationGroup="group" />
</asp:View>
</asp:MultiView>
</ContentTemplate>
<Triggers>
<asp:PostBackTrigger ControlID="save_button" />
</Triggers>
</ajax:UpdatePanel>
【问题讨论】:
标签: .net asp.net ajax file-upload updatepanel