views:

1227

answers:

5

Hi,

My page is fully postback twice. I am using master page with AJAX. The structure of master page is as follows.

+---------------------------------------------+

| Web User Control with AJAX Tab Control |

+---------------------------------------------+

| | | |

| Col1 | ContentPlaceHolder | Col3 |

| | | |

| | | |

+---------------------------------------------+

The web user control contains the AJAX Tab Container with AutoPostback on.

I have created several ASPX pages using this masterpage.

The content place holder also gets a web user control depending upon page.

Whenever I jump on a page by clicking on tab the page is fully postbacked twice. I dont understand whats the reason. That makes viewing reports cumbersome as it requires double time.

Please visit - http://softwaregenius.net/ivnew4 to get idea. I am not able to give loginid.

A: 

We might need more information but how are you're Update panels laid out and configured? Do you have update panels?

If you don't have update panels, the auto post back will occur and it will post back the entire page. If the control is surrounded by an update panel, only the update panel is re-rendered.

colithium
A: 

Double post backs for me tend to be missing resources or image tags without a src - E.G.

<img src=""/>
TWith2Sugars
A: 

When Page directive autoeventwireup is true and you attach an event OnInit to things like Page_Load, those events will be raised twice, making it look like double postback. It could be semething else, too.

MatthewMartin
Hi Mattew, I think you are right. Because I have also used OnInit. Anyway I have now removed AutoPostback for TabContainer and calling the pages using javascript.Thanks again.
IrfanRaza
A: 

Hi
Is there any code in the page that make you postback twice.
Try the use the method if(!page.ispostback){}
I think it is not because of AJAX.

Edwin Tai
A: 

I was in the exact situation and got frust for quite a while. Thought someone might still find this useful. My page involved a lot of custom ajax call (not update panel), and when post back for saving ( implementing request[".."] style not control.value style - cause the controls was create dynamically thru Ajax ), postback happened twice. There are 2 solutions and both are simple:

  1. Set AutoEventWireup to false (this will also disable some custom control that was wired up for instance databinded datagrid, like my case)
  2. for those who required AutoEventWireup to be true, just make sure all post back controls or buttons is not server control instead they must be standard HTML tags and should NOT have runat="server".

That's it!