ASP.NET - how to redirect form in new tab??

Asked By mani on 14-Jul-11 03:40 AM
hi..i used this line to redirect form...but how can i redirect to a form in new tab???i used lot of code in javascript but not
working..

Response.Redirect("Fullview.aspx?id=" + HiddenField1.Value);

but if my login failed i should stay in same page and print some message...invalid
Reena Jain replied to mani on 14-Jul-11 03:47 AM
Hi,
 
But in its simplest form, following code open new tab/window.
 
<asp:Button ID="btnNewEntry" runat="Server" CssClass=”"button" Text="New Entry" OnClick="btnNewEntry_Click" OnClientClick="aspnetForm.target =’_blank’;"/>
 
<%– aspnetForm.target =’_blank’ will add handler to open new tab–%>
 
protected void btnNewEntry_Click(object sender, EventArgs e)
{
Response.Redirect(”New.aspx”);
}
 
OR
 
Response.Write( "<script> window.open( ‘pageName.aspx’ ); </script>");
Response.End();
 
Hope this will help you
dipa ahuja replied to mani on 14-Jul-11 03:47 AM
Go in the sequence like

protected void Button2_Click(object sender, EventArgs e)
  {
    //Code login
    //if login unsuccessful 
        //Label.Text = "login failed"
    //else 
        //Response.Redirect("Fullview.aspx?id=" + HiddenField1.Value);
  }
Devil Scorpio replied to mani on 14-Jul-11 03:50 AM
Hi Mani,

try this

 Step 1. write java script in aspx.

<script language="javascript">
 function test()
{
  window.open('webform6.aspx','_balnk',null,'scrollbars=yes');
}
</script>


 Step 2. In the Page load [Codebehid] Register this

 in the Page Load

 Button1.Attributes.Add("onclick","return Test()");
 //Here Buttin1 is Server side Control


Hope this will help you
Jitendra Faye replied to mani on 14-Jul-11 04:02 AM
If you are using Jquery Tab then you can set focus to particular tab after Redircting.

Pass tabid using response.Redirect(), and get this id in next page.

like this-

.tabs( "select" , index )

Select a tab, as if it were clicked. The second argument is the zero-based index of the tab to be selected or the id selector of the panel the tab is associated with (the tab's href fragment identifier, e.g. hash, points to the panel's id).

Follow this link also-

http://jqueryui.com/demos/tabs/#method-select

Hope this will help you.

Ravi S replied to mani on 14-Jul-11 04:03 AM
HI

try htis

RegisterStartupScript ("startupScript", "<script language=JavaScript>alert('Sucessfully Add Number.');</script>");

response.redirect("page.aspx");