使用弹出窗体中的命令按钮关闭Ajax Modal Popup

时间:2016-05-19 07:40:41

标签: asp.net vb.net ajaxcontroltoolkit modalpopupextender

我有两个aspx页面。在第一页上,我对ModalPopupExtender进行了硬编码,并将其命名为ID="mp1",如下所示:

<cc1:ModalPopupExtender ID="mp1" runat="server"
    PopupControlID="Panl1" TargetControlID="HiddenControl1"
    BackgroundCssClass="Background" >
</cc1:ModalPopupExtender>
<asp:Panel ID="Panl1" runat="server" CssClass="Popup" style = "display:none" >
    <iframe style=" width: 400px; height: 300px;" id="irm1" src="Form2.aspx" runat="server">
    </iframe>
    <br/>
</asp:Panel>

我没有指定CancelControlID,因为我希望使用src="Form2.aspx"内的按钮关闭弹出窗口。我尝试在mp1中调用Form2.aspx.vb控件,但使用此代码时出现NullReferenceException错误:

 Protected Sub cmdCancel_Click(sender As Object, e As EventArgs) Handles cmdCancel.Click
    If MsgBox("Are you sure you want to quit?", vbYesNo + vbCritical, "Warning") = vbYes Then
        Dim parentForm As New Upload_File 'Upload_File is the class name of the First Form
        parentForm.mp1.Hide()
    End If
End Sub

0 个答案:

没有答案