How I can avoid an useless post back?

L

Lorenzo Sgorlon

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?
 
A

Alvin Bruney [MVP]

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
 

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,776
Messages
2,569,603
Members
45,189
Latest member
CryptoTaxSoftware

Latest Threads

Top