【问题标题】:How to get FileUpload file from ModalPopupExtender?如何从 ModalPopupExtender 获取 FileUpload 文件?
【发布时间】:2013-09-16 08:07:31
【问题描述】:

我得到了这个模态弹出扩展器,但我无法获取 FileUpload 控件上的文件。这是我的代码:

<asp:Button ID="targC" runat="server" Style="display: none;" Text="here" />
    <ajax:ModalPopupExtender ID="myExtender" runat="server" BackgroundCssClass="myModalPopupbackGrnd"
        TargetControlID="targC" PopupControlID="pnlUserRegNoti" OkControlID="btnDone">
    </ajax:ModalPopupExtender>
    <asp:Panel ID="pnlUserRegNoti" Width="70%" Style="display: none;" CssClass="myModalPopupload"
        runat="server">
<center>
            <br />
            <br />
            <table width="80%">
                <tr>
                    <td>
                        <center>
                            <h3><b>Requirements of New Application</b></h3>
                            <asp:HiddenField ID="validateUploads" runat="server" />
                            <table>
                                <tr>
                                    <td>DTI Application Form</td>
                                    <td><asp:FileUpload ID="dtiFileUpload" runat="server" onchange = "return CheckForTestFileDTI();" />
                                    <asp:CustomValidator ID="CustomValidator1" ControlToValidate="dtiFileUpload" runat="server" OnServerValidate="CustomValidator1_ServerValidate" Text="File is too large. Max size is 20MB."></asp:CustomValidator>
                                    </td>
                                    </tr>
<tr>
                    <td>
                        <center>
                            <asp:Button ID="btnDone" runat="server" CssClass="button" Text="Done" OnClick="btnDone_Click" />
                        </center>
                    </td>
                </tr>
            </table>
        </center>
    </asp:Panel>

我将使用 FileUpload 控件上的文件上传到 WindowsAzure。如何在 modalpopupextender 中获取文件上传的值?

【问题讨论】:

    标签: asp.net modalpopupextender


    【解决方案1】:

    您需要从面板中检索该 FileUpload 以在您的代码中与它进行交互:

    FileUpload dtiFileUpload = (FileUpload)pnlUserRegNoti.FindControl("dtiFileUpload");
    

    【讨论】:

      猜你喜欢
      • 2014-02-14
      • 2013-08-24
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-06-03
      • 2011-05-13
      相关资源
      最近更新 更多