Before looking at the code, Read about – What is JumpStart?
NOTE :-
- The main motive behind writing this code snippet is that this topic has been asked number of times @forums.
- Response.Redirect() by itself never opens a page in a new blank window, so the trick lies in using the JavaScript. We use the OnClientClick property of the Button to open a new window.
- The credit of the code goes to a MSFT (I never knew his name) for providing this sample @forums.
================================================================================================
Page.aspx
================================================================================================
<%@ Page Language="C#"%> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <script runat="server"> protected void Page_Load(object sender, EventArgs e) { } protected void Button1_Click(object sender, EventArgs e) { Response.Redirect("http://www.google.com"); } </script> <html xmlns="http://www.w3.org/1999/xhtml"> <head id="Head1" runat="server"> <title></title> </head> <body> <form id="form1" runat="server"> <div> <asp:Button ID="Button1" runat="server" Text="Button" onclick="Button1_Click" OnClientClick ="document.forms[0].target = '_blank';" /> </div> </form> </body> </html>
================================================================================================
OUTPUT
================================================================================================
Disclaimer:
All coding and suggestions made in the above discussion is strictly in point of view of the author. It is neither mentioned any where nor even concluded that this is the only possible way to go with, as there will be always a chance for a new approach in achieving the same requirement (in context of programming). The above mentioned code is strictly written and explained for the sake of new comers to C# and ASP.NET world.






