Double UpdatePanel下的FileUpload完全回发问题

时间:2015-03-30 07:43:14

标签: c# asp.net vb.net file-upload updatepanel

      <asp:UpdatePanel runat="server"><ContentTemplate>
     <asp:UpdatePanel ID="PanelImportFileForCSV" Visible="false" runat="server">                                              
       <ContentTemplate>
       <div class="form-group" runat="server">
        <label for="textfield" class="control-label col-sm-4">CSV File<span class="ErrorMessage" style="color: red;">&nbsp;*</span>/label>
       <div class="col-sm-8">
        <asp:FileUpload runat="server" ID="FileUpload2" />                                                               <asp:RegularExpressionValidator runat="server" ID="RegularExpressionValidator2" ControlToValidate="FileUpload1" ForeColor="DarkRed" ErrorMessage="Only (.mpp) File is allowed" ValidationExpression="^(([a-zA-Z]:)|(\\{2}\w+)\$?)(\\(\w[\w].*))(.csv|.CSV)$" />
      </div>
      </div>
     </ContentTemplate>                              
      </asp:UpdatePanel>
     </ContentTemplate                                              
     </asp:UpdatePanel>
   <div class="row">
    <div class="col-sm-12">
    <div class="form-actions">
    <asp:button id="btnProceed" runat="server" CssClass="btn" ToolTip="Cancel" Text="Proceed" OnClick="btnProceed_Click"  CausesValidation="False"></asp:button>
    </div>
    </div>
    </div>

我知道我应该使用触发器进行文件上传的完全回发,但我有多个更新面板,这个想法不再有用了!

请帮助我

1 个答案:

答案 0 :(得分:0)

Nvm我已经通过在page_Load()

中添加以下行来解决了这个问题
 Page.Form.Attributes.Add("enctype", "multipart/form-data")