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!

Pop Up in ASP.net

Status
Not open for further replies.

need2progm

Programmer
Dec 13, 2002
92
US
I know how to do this in old asp...but how do I get an a Response.Redirect (in vb code behind) to pop a new window with intended .aspx page? [on_click event]

Thanks
 
No can do. You need to send some javascript back to the client Response.Redirect doesn't support this.

use a stringbuilder to build a javascript script. Then use the RegisterStartupScript method to add the new script to the page. That'l do donkey, that'l do
[bravo] Mark
If you are unsure of forum etiquette check here faq796-2540
 
I have never used StringBuilder ....I found some other examples in past threads... is this what I want?

Dim sbPop As New StringBuilder()
sbPop.Append(&quot;<Script Language=Javascript>&quot;)
sbPop.Append(&quot;<a href=&quot;&quot; onclick='window.open('PopUpWindow.aspx')'value='open'>&quot;)
sbPop.Append(&quot;</Script>&quot;)
RegisterStartupScript(&quot;Open Window&quot;, sbPop.ToString())
sbPop = Nothing

What is RegisterStartupScript?


Quick note:
I was able to get a popup using 'spaghetti' code...warning it's ugly

<a href=&quot;&quot; onclick='window.open(&quot;PopUpWindow.aspx&quot;)' >
<asp:Button id=&quot;btnEdit&quot; style=&quot;Z-INDEX: 117; LEFT: 40px; POSITION: absolute; TOP: 368px&quot; runat=&quot;server&quot; Height=&quot;48px&quot; Text=&quot;Edit Answer&quot; Width=&quot;104px&quot;>
</asp:Button>
</a>


I want to do this a beter way.

Thanks
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top