Asp – Double postback causes SelectedIndexChanged to fire which fires AutoPostback

ajaxasp.netasp.net-ajaxnetupdatepanel

I have a Gridview in a UpdateTemplate. I have four template fields in the four different columns. Each TemplateField has an UpdatePanel with a control in it. All the columns are sortable and the Gridview is page-able. Three of the template fields has DropDowns in the UpdatePanel and one has a Textbox, all these controls have AutoPostBack = True. All the UpdatePanels have UpdateMode = Conditional and ChildrenAsTriggers = false.

When I click sort or change page index and the results have not returned and do it again(click sort or page index) while it is busy the SelectedIndexChanged and TextChanged events fires on some of the controls.

It seems that depending on when I do this some of the results has been refreshed and there events don't fire but some are still busy, and the second Postback halts the first one and thinks that the values have changed and fires there respective AutoPostBackt events. When all the events fired the grid then displays the intended result set that was expected from the first sort or page index change.

Best Answer

Is there a question here?

One thing you can do is add a "busy" display while waiting for the first Ajax call and disable the controls that would cause another postback. Remember what the first A stand for in AJAX: asynchronous.

Related Topic