asp:UpdatePanel中的HTML输入

时间:2012-04-10 03:23:42

标签: asp.net html file-upload updatepanel

我在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;
当我单步执行代码时,

filename始终为空。

我做错了什么?

1 个答案:

答案 0 :(得分:2)

FileUpload控件已知UpdatePanel的问题。查看之前的讨论:FileUpload control inside an UpdatePanel without refreshing the whole page?