How can I send a popup to the current page?

J

Jim

I have a page that will have seveal links on it to pop up one of a
number of different financial tools. I'd like for the financial tools
to come up in their own window. Preferably, I'd even like to keep
them in the foreground until the user hit's the popups "Close" button
(my 401(K) site at Vanguard does this, and I think it's pretty neat).
I guess this request entails a couple of questions:

1. Currently, I have some JavaScript on the page that does something
like this:

function DoPopup()
{
window.open("www.mysite.com/popupthing.aspx", "_blank", null, false);
}

This works fine if I call it from a normal HTML tab like <a
href="javascript:DoPopup();">Click this</a>, but what if I wanted this
to happen in resposne to an ASP button or ASP LinkButton? I tried
this in my code:

<asp:LinkButton id="PopupButton" OnClick="OnClickPopup"
runat="Server">Click this</asp:LinkButton>

and then in my codebehind:

public void OnClickPopup( object sender, System.EventArgs e)
{
string html = "<script language=JavaScript........"; // blah blah
blah javascript to do the popup...

Response.Write( html);
Response.End();
}

However, when I do this and click the link on my page, I get a whole
new (blank) page... How do I incorporate the current ASP page in the
response and then add this on to it, or should I be going about this
differently? Thanks!

Jim
 
G

Guest

Respose.Write writes html (or whatever) to the browser and is used to dynamically create content. You need the JavaScript to react to the event. As it is now, the browser doesn't even know about the JavaScript until your new page is loaded, and it is in no way asociated with your button
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top