Click here to Skip to main content
15,891,704 members
Please Sign up or sign in to vote.
1.00/5 (3 votes)
See more:
Dear sir,

I want to open an asp page in new window when I click on a button. and pass a value through it by using query string.Plz sir solve this small problem for me...
Posted
Comments
Kornfeld Eliyahu Peter 20-Jul-14 14:59pm    
It's so small a problem that you do not need us - you only need Google...
Bhanu Pratap Verma 22-Jul-14 2:47am    
Please do google before small problem you faced.

Please set target is blank for the button...

What do you need us for?

All you had to do what type "ASP.NET open page in new window[^]" into Google and do a little reading.
 
Share this answer
 
Comments
Atyant Srivastava 21-Jul-14 0:17am    
Dave!! Coolest reply...
Ranjeet Patel 22-Jul-14 6:14am    
Really cool... ha ha ha
try this,put the line in ur button click event
C#
ScriptManager.RegisterClientScriptBlock(this, typeof(string), "OPEN_WINDOW", "var Mleft = (screen.width/2)-(760/2);var Mtop = (screen.height/2)-(700/2);window.open( 'MyPage.aspx?recepitno=" + ID + "', null, 'height=600,width=650,status=yes,toolbar=no,scrollbars=yes,menubar=no,location=no,top=\'+Mtop+\', left=\'+Mleft+\'' );", true);
 
Share this answer
 
v2
Comments
bigyan sahoo 22-Jul-14 2:07am    
Thank u sir.
It worked perfectly but how to open in new tab instead of new window.
Dave Kreskowiak 22-Jul-14 8:25am    
Wow. You gave him a fish to eat instead of teaching him how to catch fish for himself. Congratulations. You've taught him nothing.
[no name] 23-Jul-14 0:09am    
thanx dave for ur reply..ur right..i will try to correct myself next tym..improving!!!
C#
protected void btnNewEntry_Click(object sender, EventArgs e)
{
   Page.ClientScript.RegisterStartupScript(
   this.GetType(),"OpenWindow","window.open('YourURL','_newtab');",true);
}

refer linkhttp://stackoverflow.com/questions/10493901/how-to-open-a-page-in-new-tab-on-button-click-in-asp-net[^]
 
Share this answer
 
Comments
bigyan sahoo 22-Jul-14 3:17am    
Thank u sir for this help...
try this code:
HTML
<input type='button' value='hi' onclick="javascript:window.open('http://www.google.com','_newtab')">
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900