Double postback problem

I have an ASP.NET 1.1 application, and I'm trying to find out why, when I change the ComboBox, the value of which is used to populate another (parent-child relationship), two inverse queries are created.

I checked and checked the code and I can not find the reason.

Here are both call stacks that end on page_load

First postback (generated by ComboBox answering machine)

Callback Stack (not working)

Second postback (this is what I want to find out why this happens)

alternate text (doesn't work)

Any suggestion? What can I check?

+6
source share
5 answers

This is a very specific problem with this code, I doubt it will be useful for anyone else, but here it is:

A check with if was added to the onchange combo, if the condition was met, an explicit call to the postback function was made. If the combo was set to AutoPostback , asp.net added the callback again, creating two callbacks ...

The generated html was like this:

 [select onchange="javascript: if (CustomFunction()){__doPostBack('name','')}; __doPostBack('name','')"] 
+5
source

The first thing I would like to find is that you do not have the second ComboBox AutoPostBack property set to true. If you change the value in the second combo with this value of the true property, I believe that it will generate a postback for this control.

0
source

Do you have a code to share? The double post-backs scoffed at classic ASP so much that it ultimately prompted me to switch to .NET once and for all. Whenever I encounter problems like these for .NET, I go to each CONTROL and every PAGE element like load, init, prerender, click, SelectedIndexChanged, etc. And puts a breakpoint.

Even if I don’t have the code, I will enclose something like:

 Dim i As Integer i = 0 

I can usually identify some actions that I did not expect and did not correct as necessary. I would suggest you do it here.

Good luck.

0
source

Check Request.Form ["__ EVENTTARGET"] to find the control that triggers the postback, which may help you narrow it down.

Looking at the brake lights and some Reflectoring (in ASP.NET 2 - I don't have 1.1 at hand) - it looks like SessionStateModule.PollLockedSessionCallback is part of the HttpApplication startup routines. Perhaps your application will be redesigned - I'm sure the event is being written to the event log for this.

My only other suggestion is Fiddler or something on the client to capture HTTP traffic.

0
source

This is a very old post, but people still look at it for a solution exactly the same as last week.

Like Grengby, double events are the main reasons, but removing one of them is not always possible. At least in my case, and I had to resolve this on a third-party application.

I added the following script and changed the ASP form on the main page:

 <script>var Q = 0;</script> <form id="Form1" runat="server" onsubmit="Q++; if(Q==1){return true;} else { return false;}"> 

This seems to work and please send your comments.

Arun

http://www.velocityreviews.com/forums/t117900-asp-net-multiple-postback-issue.html

0
source

Source: https://habr.com/ru/post/1276394/


All Articles