Javascript in ASP.NET - Pop another window

Discussion in 'ASP .Net' started by Nevyn Twyll, Jul 31, 2003.

  1. Nevyn Twyll

    Nevyn Twyll Guest

    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!

     
    Nevyn Twyll, Jul 31, 2003
    #1
    1. Advertisements

  2. 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

    Nevyn Twyll wrote:

    > 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!
    >
    >
    >
    >
    >
    >
    >
     
    Cheung, Jeffrey Jing-Yen, Jul 31, 2003
    #2
    1. Advertisements

  3. Nevyn Twyll

    Nevyn Twyll Guest

    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?

    "Cheung, Jeffrey Jing-Yen" <> wrote in message
    news:...
    > 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
    >
    > Nevyn Twyll wrote:
    >
    > > 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!
    > >
    > >
    > >
    > >
    > >
    > >
    > >

    >
     
    Nevyn Twyll, Jul 31, 2003
    #3
  4. Nevyn Twyll

    Saravana Guest

    Check out this article,
    http://www.microsoft.com/india/msdn/articles/PopupCalendarinASP.aspx

    --
    Saravana
    Microsoft India Community Star,MC**
    www.ExtremeExperts.com



    "Nevyn Twyll" <> wrote in message
    news:#...
    > 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?
    >
    > "Cheung, Jeffrey Jing-Yen" <> wrote in

    message
    > news:...
    > > 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
    > >
    > > Nevyn Twyll wrote:
    > >
    > > > 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!
    > > >
    > > >
    > > >
    > > >
    > > >
    > > >
    > > >

    > >

    >
    >
     
    Saravana, Aug 1, 2003
    #4
    1. Advertisements

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Hai Nguyen

    Pop up window in asp.net

    Hai Nguyen, Feb 13, 2004, in forum: ASP .Net
    Replies:
    2
    Views:
    757
    Joe Fallon
    Feb 14, 2004
  2. Ryan Ternier

    Close a Pop up window with ASP.NET (VB)

    Ryan Ternier, Jun 18, 2004, in forum: ASP .Net
    Replies:
    1
    Views:
    12,691
    Cowboy \(Gregory A. Beamer\) [MVP]
    Jun 18, 2004
  3. Yi Chen

    How to pop up a new window in ASP.NET

    Yi Chen, Nov 2, 2004, in forum: ASP .Net
    Replies:
    2
    Views:
    2,428
    Saravana
    Nov 2, 2004
  4. seep

    Pop Up Window..ASP.NET

    seep, Dec 21, 2004, in forum: ASP .Net
    Replies:
    3
    Views:
    5,590
    santhanamk
    Apr 29, 2010
  5. semesm22

    ASP.NET pop up window

    semesm22, Dec 9, 2005, in forum: ASP .Net
    Replies:
    1
    Views:
    735
    =?Utf-8?B?U3JpZGhhcg==?=
    Dec 9, 2005
  6. Replies:
    1
    Views:
    793
    Norman Yuan
    Jul 6, 2007
  7. Madame Blablavatsky
    Replies:
    8
    Views:
    417
    Dr John Stockton
    Sep 16, 2005
  8. Jimmy
    Replies:
    3
    Views:
    348
    David Mark
    Oct 7, 2007
Loading...