我在 asp:UpdatePanel 中有一个 html 输入控件,并且在 asp:PostBackTrigger 标记中指定了其关联的上传按钮。这是aspx代码:
<asp:UpdatePanel ID="upGallery" UpdateMode="Conditional" runat="server">
<ContentTemplate>
<portal:ModuleTitleControl id="Title1" runat="server" />
<portal:OuterBodyPanel ID="pnlOuterBody" runat="server">
<portal:InnerBodyPanel ID="pnlInnerBody" runat="server" CssClass="modulecontent">
<div id="Uploader" runat="server">
<h2>Upload a docx file to be translated.</h2>
<input id="input_FileUpload" runat="server" type="file" />
<asp:Button ID="button_UploadFile" runat="server" OnClick="button_UploadFile_Click" Text="Upload" />
</div>
</portal:InnerBodyPanel>
</portal:OuterBodyPanel>
</ContentTemplate>
<Triggers>
<asp:PostBackTrigger ControlID="button_UploadFile" />
</Triggers>
</asp:UpdatePanel>
下面是检索输入控件“input_FileUpload”值的代码:
string filename = input_FileUpload.Value;
当我单步执行代码时,文件名始终为空。
我究竟做错了什么?