views:

1205

answers:

8
A: 

First thing I would look for is that you don't have the second ComboBox's AutoPostBack property set to true. If you change the value in the second combo with that property set true, I believe it will generate a postback on that control.

DannySmurf
A: 

@Greg: AutoEventWireUp is set to false, AutoPostback for the combo (as I said), is set to true.

@DannySmurf: The second one also is set to true, but that's required because it also is used to fill a third one. In any case, if you Bind it to new data in the server (consequence of the first one's postback) it doesn't generate a new postback

Juan Manuel
A: 

Do you have any code you could share? Double post backs plagued me so much in classic ASP back in the day that it was what finally prompted me to switch to .NET once and for all. Whenever I have problems like these for .NET, I go to every CONTROL and every PAGE element like load, init, prerender, click, SelectedIndexChanged, and the like and put a breakpoint.

Even if I don't have code there, I'll insert something like:

Dim i As Integer
i = 0

I am usually able to pinpoint some action that I wasn't expecting and fix as needed. I would suggest you do that here.

Good luck.

Jason Shoulders
A: 

Check Request.Form["__EVENTTARGET"] to find the control initiating the postback - that may help you narrow it down.

Looking at the callstacks, and some Reflectoring (into ASP.NET 2 - I don't have 1.1 handy) - it looks like SessionStateModule.PollLockedSessionCallback is part of the HttpApplication startup routines. It may be possible that your app is being recycled - I'm pretty sure an event gets written into the Event log for that.

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

Mark Brackett
A: 

Found it!

It was some strange code in the control...

Now I need to track the programmer down to... show him his mistakes; thank god for source code version control =)

Thanks for all the answers

Juan Manuel
+1  A: 

It's a very specific problem with this code, I doubt it will be useful for someone else, but here it goes:

A check was added to the combo's onchange with an if, 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 postback call again, producing the two postbacks...

The generated html was like this:

[select onchange="javascript: if (CustomFunction()){_doPostBack('name','')}; _doPostBack('name','')"]

Juan Manuel
A: 

Hi Juan, under certain circumstances i get the same problem with the same call stack. What was the "strange code" you found? Thank you in advance, Misha

it's there on my self-accepted answer, notice the both _doPostBack calls
Juan Manuel
A: 

Hi Guys,

This is very old post, but people still looking at this for solution exactly same as I did last week.

Like Grengby said Double events are primary reasons - but removing one of them is not allways an option. Atleast on my case and I had to resolve this on 3rd party's application.

I added following script and amended ASP form on masterpage:

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

This seems to be working and please forward your comments.

Arun

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

Ealavan