我有两个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