How I can avoid an useless post back?

Discussion in 'ASP .Net Web Controls' started by Lorenzo Sgorlon, Jan 31, 2005.

  1. I have a webform with some TextBoxes and some LinkButtons. On some TextBoxes
    I set the Autopostback property to True, so I can get a postback by changing
    the content of those TextBoxes or by clicking on a LinkButton. Sometime It
    happens that the user makes a change in a "autopostback" TextBox, the submit
    starts through the .NET __dopostback routine, it can happen that the old aspx
    page keeps on staying in the user browser for 2, 3 or more seconds, this
    delay time allows the user to click on a LinkButton before the first
    round-trip has been completed. It makes my server application go mad.
    I decided to handle the onclick event of the LinkButtons at client side. I
    found a trick to avoid an other LinkButton submit during the first submit,
    but I cannot avoid the second postback when the submit is fired by a TextBox
    (through autopostback=true). I saw, ASP.NET adds
    "onchange="__doPostBack(...)", but it has not helped me so far.
    I hope to have explained properly my problem.
    Do you have any advice?
     
    Lorenzo Sgorlon, Jan 31, 2005
    #1
    1. Advertising

  2. One approach is to wrap your entire page in a div or panel. Then handle the
    onclick clientside by setting the div/panel to invisible. On page_load, set
    the div/panel to visible. The effect of this approach is to show a blank
    page as soon as the button is clicked preventing the user from taking
    further action.

    --
    Regards,
    Alvin Bruney [MVP ASP.NET]

    [Shameless Author plug]
    The Microsoft Office Web Components Black Book with .NET
    Now Available @ http://tinyurl.com/27cok
    ----------------------------------------------------------


    "Lorenzo Sgorlon" <Lorenzo > wrote in
    message news:D...
    >I have a webform with some TextBoxes and some LinkButtons. On some
    >TextBoxes
    > I set the Autopostback property to True, so I can get a postback by
    > changing
    > the content of those TextBoxes or by clicking on a LinkButton. Sometime It
    > happens that the user makes a change in a "autopostback" TextBox, the
    > submit
    > starts through the .NET __dopostback routine, it can happen that the old
    > aspx
    > page keeps on staying in the user browser for 2, 3 or more seconds, this
    > delay time allows the user to click on a LinkButton before the first
    > round-trip has been completed. It makes my server application go mad.
    > I decided to handle the onclick event of the LinkButtons at client side. I
    > found a trick to avoid an other LinkButton submit during the first submit,
    > but I cannot avoid the second postback when the submit is fired by a
    > TextBox
    > (through autopostback=true). I saw, ASP.NET adds
    > "onchange="__doPostBack(...)", but it has not helped me so far.
    > I hope to have explained properly my problem.
    > Do you have any advice?
    >
    >
     
    Alvin Bruney [MVP], Jan 31, 2005
    #2
    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,639
  2. Alexander Malkis
    Replies:
    8
    Views:
    526
    Alexander Malkis
    Apr 14, 2004
  3. loga123
    Replies:
    9
    Views:
    48,207
    mamikel
    May 15, 2009
  4. Daniel Nogradi
    Replies:
    0
    Views:
    386
    Daniel Nogradi
    Nov 15, 2006
  5. =?Utf-8?B?Z29yaWxsYQ==?=
    Replies:
    1
    Views:
    775
    Masudur
    May 25, 2007
Loading...

Share This Page