Button post back.........

Discussion in 'ASP .Net' started by John, Mar 5, 2004.

  1. John

    John Guest

    I have attached the java script code to Button web control as follows.

    myButton.Attributes.Add("OnClick", "OpenWindow()")

    I have written java script to open the window in the OpenWindow function.

    When I click on the myButon, new window will open and at the sametime
    button is posting back the form(?) and the main window comes up and the
    opened window goes behind. So that my purpose of displaying the data(window)
    is lost. how to make sure that the opened window will remain on top in the
    clicked event of button.
    Thanks
    john
     
    John, Mar 5, 2004
    #1
    1. Advertising

  2. John

    Gönen EREN Guest

    Hi John,

    Here is your answer...

    In the popup window put the fallowing in the body tag :

    onblur="window.focus()"


    You'll see the result is better then you think. =)

    Gönen.


    "John" <> wrote in message
    news:...
    > I have attached the java script code to Button web control as follows.
    >
    > myButton.Attributes.Add("OnClick", "OpenWindow()")
    >
    > I have written java script to open the window in the OpenWindow function.
    >
    > When I click on the myButon, new window will open and at the sametime
    > button is posting back the form(?) and the main window comes up and the
    > opened window goes behind. So that my purpose of displaying the

    data(window)
    > is lost. how to make sure that the opened window will remain on top in the
    > clicked event of button.
    > Thanks
    > john
    >
    >
     
    Gönen EREN, Mar 5, 2004
    #2
    1. Advertising

  3. John

    seniorwebguy

    Joined:
    Jul 19, 2006
    Messages:
    1
    Location:
    Hodgenville, KY
    Interesting answer Gönen but it didn't work for me.

    Here is what I did:

    Code:
    protected override void Render(HtmlTextWriter writer)		
    {
    [INDENT]base.Render(writer);
    
    // The code had to be placed here so that the new window would 
    // remain on top.
    if (this.IsPostBack && this.IsValid)
    	Response.Write("<script>OpenWindow();</script>");[/INDENT]}
    
    Also the OpenWindow function needs to set the focus to the new window (i.e. newWin.focus();)
     
    seniorwebguy, Jul 19, 2006
    #3
    1. Advertising

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. Joby
    Replies:
    0
    Views:
    1,646
  2. sylvia sil
    Replies:
    1
    Views:
    630
    Curt_C [MVP]
    Dec 29, 2004
  3. =?Utf-8?B?Z29yaWxsYQ==?=
    Replies:
    1
    Views:
    792
    Masudur
    May 25, 2007
  4. Author
    Replies:
    6
    Views:
    3,118
    George
    Jan 22, 2009
  5. Useful Info

    Firefox back button takes me back 2 pages.

    Useful Info, Jun 3, 2007, in forum: Javascript
    Replies:
    0
    Views:
    348
    Useful Info
    Jun 3, 2007
Loading...

Share This Page