Javascript in ASP.NET - Pop another window

  • Thread starter Thread starter Nevyn Twyll
  • Start date Start date
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)
 
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
 
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?
 
Back
Top