Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Double postback issue

I have a ASP.NET 1.1 application, and I'm trying to find out why when I change a ComboBox which value is used to fill another one (parent-child relation), two postbacks are produced.

I have checked and checked the code, and I can't find the cause.

Here are both call stacks which end in a page_load

First postback (generated by teh ComboBox's autopostback)

Postback call stack (broken)

Second postback (this is what I want to find why it's happening)

alt text (broken)

Any suggestion? What can I check?

like image 881
juan Avatar asked Aug 21 '08 15:08

juan


People also ask

What is the meaning of postback?

In web development, a postback is an HTTP POST to the same page that the form is on. In other words, the contents of the form are POSTed back to the same URL as the form. Postbacks are commonly seen in edit forms, where the user introduces information in a form and hits "save" or "submit", causing a postback.

Why do we need postback?

Why are Postback URLs important? Postback URLs are important for many reasons. First of all, they allow performance marketers (AKA affiliate marketers) to track and attribute conversions to their ad campaigns. This is done without placing a tracking pixel on the merchant's “thank you page”.

What happens during postback?

PostBack is the name given to the process of submitting an ASP.NET page to the server for processing. PostBack is done if certain credentials of the page are to be checked against some sources (such as verification of username and password using database).

What is a postback action?

A Postback is an action taken by an interactive webpage, when the entire page and its contents are sent to the server for processing some information and then, the server posts the same page back to the browser.


1 Answers

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','')"]
like image 60
juan Avatar answered Sep 25 '22 03:09

juan