[英]Calling One Form From Another
I'm trying to use ShowDialog to display a pop up box from my aspx page then grab the return value from it. 我正在尝试使用ShowDialog从我的aspx页面显示一个弹出框,然后从中获取返回值。 I created my form to be called but can't get it to register with my initial page. 我创建了要调用的表单,但无法将其注册到初始页面。 Here is all the code in my new form; 这是我的新形式,所有的代码;
Partial Class MyForm
Inherits System.Web.UI.Page
End Class
And the relevant code from my initial page; 还有我初始页面中的相关代码;
Partial Class List
Inherits System.Web.UI.Page
Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs)
Dim request As New MyForm
End Sub
End Class
But Visual Studio doesn't recognise MyForm
. 但是,Visual Studio中无法识别MyForm
。 What am I doing wrong? 我究竟做错了什么?
Not sure if they're relevant but here's the page declaration for my new page; 不确定它们是否相关,但这是我的新页面的页面声明;
<%@ Page Language="VB" AutoEventWireup="false" CodeFile="MyForm.aspx.vb"
Inherits="MyForm" %>
and for my original form; 以我的原始形式;
<%@ Page Language="VB" MasterPageFile="../../../Site.master"
CodeFile="List.aspx.vb" Inherits="List" %>
You can not display a pop up box in ASP.NET using ShowDialog the way you do in Windows Forms. 您无法像在Windows Forms中那样使用ShowDialog在ASP.NET中显示弹出框。 If you need to display a pop up in ASP.NET use ASP.NET ModalPopup or JQuery dialog 如果需要在ASP.NET中显示弹出窗口,请使用ASP.NET ModalPopup或JQuery对话框
Also, in ASP.NET you don't call a form as you are doing. 另外,在ASP.NET中,您不会像现在那样调用表单。 You simply redirect to it. 您只需重定向到它。 Check HttpResponse.Redirect Method 检查HttpResponse.Redirect方法
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.