如何从ModalPopupExtender获取FileUpload文件?

时间:2013-09-16 08:07:32

标签: asp.net modalpopupextender

我有这个模态弹出扩展程序,但我无法获取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中获取文件上传的值?

1 个答案:

答案 0 :(得分:0)

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

FileUpload dtiFileUpload = (FileUpload)pnlUserRegNoti.FindControl("dtiFileUpload");
相关问题