Javascript in ASP.NET - Pop another window

N

Nevyn Twyll

I've got a web form with a number of dropdowns, combos, etc.
When the user submits the form, I want to redirect them to another form, but
I need to pop it in another window. So, I have a hyperlink on the form
whose NavigateURL gets refreshed whenever the user makes a selection
(...NavigateUrl = '<%#DataBinder.Eval(Container, "GetRedirect()") %>'...) -
but it's too slow to do all those round-trips!

I understand that in the code-behind form, I can Response.Redirect(), but I
can't do it in a new window (like if you set the <asp:hyperlink
Target="_blank">).

So, could someone show me how I could link a button to some Javascript that
would call code-behind code to get the response string, and run that code in
a new window?

Thanks!

(e-mail address removed)
 
C

Cheung, Jeffrey Jing-Yen

Nevyn,

In the code-behind, you could add client side javascript like so:

' This is assuming your button name is btnSubmit

btnSubmit.Attributes.Add("onclick", "window.open(blahblah.aspx);")

HTH,

Jeff Cheung
 
N

Nevyn Twyll

So, I feel a little dumb, but since the Reponse string (blahblah.aspx) is
dynamically calculated from the selected contents of the form, how do I get
this info in there so that when the user presses the button, that info is
calculated correctly?

Do I put a javascript method in the html? How do I then reference all the
controls / etc. in my code-behind?

is there any way the javascript below (where do I put that again) can call a
code-behind method?
 

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

Members online

No members online now.

Forum statistics

Threads
473,766
Messages
2,569,569
Members
45,042
Latest member
icassiem

Latest Threads

Top