Click to See Complete Forum and Search --> : How can i display a new page


sabareeswaren
03-28-2006, 02:07 AM
Sir,

I am doing my in-house project.i want to know that, how can i display a new page while clicking a button say (WebForm1.aspx.cs), a page named (WebForm1.aspx.cs) should open? How can i do that? Please Help me.....
Thanks in advance.....

handshakeit
03-28-2006, 04:11 AM
Hi There,

simply add the code in button click function
Response.Redirect("WebForm2.aspx");
before doing this make sure that you have Webform2.aspx in your application

if don't have go to solution explorer
there right click to your project
select new item ...........

Hope this is enough
Thanx
Abhi
www.handshakeit.com

sabareeswaren
03-28-2006, 04:55 AM
hi,

Thanks for your response. but if i use the "Response.Redirect("WebForm2.aspx")" it loads in the same page itself not in a seperate page. i want that page should be as a seperate one. Plz help me...

Thanks in advance!!!!

sajjad27s
03-29-2006, 01:54 AM
If you want to open a new window, you have to write the right javascript for that.

There are two ways:

(1) on page load event put the code like this

MyButton.Attributes.Add("onclick","window.open('WebForm2.aspx');")

(2) Or write code like this in Button's Click event.

Response.Write("<script>window.open('WebForm2.aspx');</script>")

handshakeit
03-29-2006, 05:01 AM
are u using "Response>redirect("WebForm2.aspx");"
on the webform2.aspx itself
then it will offcorse redirect tothe same page
use this on some other page than webform2.aspx
this will open webform2.aspx on response of your request in same window if you want to opwn new window then follow code given by sajjad27s

Regards
Abhi
www.handshakeit.com