Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

window.open in code behind via button click event

Status
Not open for further replies.

codecomm

Programmer
Feb 14, 2007
121
US
Hello!

I'm trying to open a new window on a click event.

If I use the attributes.add in the Page_Load, then pop-up window gets hit before an update occurs...hence, the pop-up window is just a little too early.

I'm trying this in my button click event, but it's not bringing up the new window:

Response.Write("<script language=""javascript"">window.open('UpdateBudgetConfirm.aspx?UBID=" + strSAID + "','','width=500,height=320,left=200,top=200');"")</script>")

Thanks!
 
Hello!

Thanks for the replay, I'm using VB, but this is not liking the Page.ClientScript part...saying 'Client Script' is not a member of 'system.UI.web.page':

Page.ClientScript.RegisterStartupScript(Me.GetType(), "Window", "window.open('UpdateBudgetConfirm.aspx?UBID=" + strSAID + "','','width=500,height=320,left=200,top=200');", True)
 
If you are using version 1.1 of the framework, they are methods of the Page class, not the ClientScript class (this was only introduced in version 2.0).


-------------------------------------------------------

Mark,
[URL unfurl="true"]http://aspnetlibrary.com[/url]
[URL unfurl="true"]http://mdssolutions.co.uk[/url] - Delivering professional ASP.NET solutions
[URL unfurl="true"]http://weblogs.asp.net/marksmith[/url]
 
I got this to compile correctly, but it's not firing:


Page.RegisterStartupScript("Window", "window.open('UpdateBudgetConfirm.aspx?UBID=" + strSAID + "','','width=500,height=320,left=200,top=200');")
 
Still no luck:

Page.RegisterStartupScript("Window", "<script language=""javascript"">window.open('UpdateBudgetConfirm.aspx?UBID=" + strSAID + "','','width=500,height=320,left=200,top=200');"")</script>")
 
Have you checked if it is being written out to the page. If it is, then it's not an ASP.NET issue as it is then the client-side that isn't behaving like you want (and I'd suggest posting the client side code in the js forum). If it isn;t writing it out, you will have to supply the complete code for the page.


-------------------------------------------------------

Mark,
[URL unfurl="true"]http://aspnetlibrary.com[/url]
[URL unfurl="true"]http://mdssolutions.co.uk[/url] - Delivering professional ASP.NET solutions
[URL unfurl="true"]http://weblogs.asp.net/marksmith[/url]
 
I've tried the following in Page_Load, but I get a syntax error:

Page.RegisterStartupScript("Window", "<script language=javascript>function AlertUpdate() {window.open('UpdateBudgetConfirm.aspx?UBID=" + strSAID + "','','width=500,height=320,left=200,top=200');})</script>")

btnYes.Attributes("onclick") = "AlertUpdate()
 
Try this in the page_load to see if it opens. it worked for me:

Page.RegisterStartupScript("Window", "<script language=\"javascript\">window.open('UpdateBudgetConfirm.aspx?UBID=" + strSAID + "','','width=500,height=320,left=200,top=200');</script>")




 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top