In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/03 Report--
This article focuses on "how to achieve ASP.NET to open a new page without closing the original page", interested friends may wish to have a look. The method introduced in this paper is simple, fast and practical. Let the editor take you to learn "how to enable ASP.NET to open a new page without closing the original page"!
The copy code is as follows:
Respose.Write ("window.open ('" + url + ");"); (open a concise window):
Respose.Write ("window.open ('" + url + ", 'resizable=1,scrollbars=0,status=1,menubar=no,toolbar=no,location=no, menu=no');")
1. Response.Redirect ("XXX.aspx", true)-go directly to the new page and the original window is replaced
2. Response.Write ("window.open ('XXX.aspx','_blank')")-keep the original window and add a new page
3. Response.Write ("_ window.location='XXX.aspx'")-opens a new page and the original window is replaced
4. Server.Transfer ("XXX.aspx")-- Open a new page
5. Response.Write ("window.showModelessDialog ('XXX.aspx')")-keep the original window and open a new window as a dialog box
6. Response.Write ("window.showModelDialog ('XXX.aspx')")-opens a new window in the form of a dialog box, and the original window is replaced
You can also write your own method:
The copy code is as follows:
Public static void ShowMessage (System.Web.UI.Page page, string msg)
{
Page.ClientScript.RegisterClientScriptBlock (page.GetType (), "a", "alert ('" + msg.ToString () + "');", true)
}
When called:
ShowMessage (this, "message to display")
Here is the code for the whole class that you can pick and use.
The copy code is as follows:
Using System
Using System.Collections.Generic
Using System.Text
Namespace WorkLogic
{
/ / /
/ / displays the message prompt dialog box.
/ / /
Public class MessageBox
{
Private MessageBox ()
{
}
/ / /
/ / display message prompt dialog box
/ / /
/ / current page pointer, usually this
/ / prompt information
Public static void ShowMessage (System.Web.UI.Page page, string msg)
{
/ / page.RegisterStartupScript ("message", "alert ('" + msg.ToString () + ");")
Page.ClientScript.RegisterClientScriptBlock (page.GetType (), "a", "alert ('" + msg.ToString () + "');", true)
}
Public static void ShowMessage (System.Web.UI.UserControl control, string msg)
{
Control.Page.ClientScript.RegisterClientScriptBlock (control.Page.GetType (), "b", "alert ('" + msg.ToString () + "');", true)
}
/ / /
/ / Control Click message confirmation prompt box
/ / /
/ / current page pointer, usually this
/ / prompt information
Public static void ShowConfirm (System.Web.UI.WebControls.WebControl Control, string msg)
{
/ / Control.Attributes.Add ("onClick", "if (! window.confirm ('" + msg+ ")) {return false;}")
Control.Attributes.Add ("onclick", "return confirm ('" + msg + "');")
}
/ / /
/ / display the message prompt dialog box and jump to the page
/ / /
/ / current page pointer, usually this
/ / prompt information
/ / the target URL of the jump
Public static void ShowAndRedirect (System.Web.UI.Page page, string msg, string url, string frame)
{
StringBuilder Builder = new StringBuilder ()
Builder.Append ("")
Builder.AppendFormat ("alert ('{0}');", msg)
Builder.AppendFormat ("top." + frame + ".location.href ='{0}'", url)
Builder.Append ("")
Page.ClientScript.RegisterStartupScript (page.GetType (), "message", Builder.ToString ())
}
/ / /
/ / output custom script information
/ / /
/ / current page pointer, usually this
/ / output script
Public static void ResponseScript (System.Web.UI.Page page, string script)
{
Page.ClientScript.RegisterStartupScript (page.GetType (), "message", "" + script + "")
}
/ / /
/ / display the message prompt dialog box and jump to the page
/ / current page pointer, usually this
/ / prompt information
/ / the target URL of the jump
Public static void ShowAndRedirect (System.Web.UI.Page page, string msg, string url)
{
StringBuilder Builder = new StringBuilder ()
Builder.Append ("")
Builder.AppendFormat ("alert ('{0}');", msg)
Builder.AppendFormat ("top.location.href=' {0}'", url)
Builder.Append ("")
Page.ClientScript.RegisterStartupScript (page.GetType (), "message", Builder.ToString ())
}
}
}
At this point, I believe you have a deeper understanding of "how to achieve ASP.NET to open a new page without closing the original page". You might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.