views:

639

answers:

0

I recently upgrade this configuration:

ASP.NET 2.0
AjaxControlToolkit, 1.0.20229.0
System.Web.Extensions, Version=2.0.0.0

To

ASP.NET 3.5
System.Web.Extensions, Version=3.5.0.0
AjaxControlToolkit , Version=3.5.40412.0

I have the following structure:

<asp:ToolkitScriptManager ID="PageScriptManager" runat="server">  
</asp:ToolkitScriptManager>  
    <asp:UpdatePanel ID="UpdatePanel3" runat="server" UpdateMode="Always">
        <ContentTemplate>
         <ajaxToolkit:TabContainer 
              OnActiveTabChanged="TabContainerCarga_ActiveTabChanged"
              AutoPostBack="True">
                        <ajaxToolkit:TabPanel 
                            ID="tabRelatorios"
                            runat="server"
                            HeaderText="Relat&#243;rios">
                                <ContentTemplate>
                                    <CustomUserControl:relatorios id="CustomControl" Visible="False" runat="server" />                                                      
                                </ContentTemplate>
                                      <Triggers>
                                        <asp:PostBackTrigger ControlID="CustomControl" />
                                      </Triggers>
                            </ajaxToolkit:TabPanel>
                  <ajaxToolkit:TabPanel ... />
                  <ajaxToolkit:TabPanel ... />
                  <ajaxToolkit:TabPanel ... />
                  <ajaxToolkit:TabPanel ... />

All the has the same first structure. At the serverside code, I have:

protected void TabContainerCarga_ActiveTabChanged(object sender, EventArgs e)
{
   //handles TabPanels show/hide and fill up forms grids.
}

CustomControl has a grid which has some post-backs to perform operation like adding and removing records. When CustomControl loads it fills two <asp:DataGrid /> components.

  1. <asp:DataGrid /> load a list with some text box, which the user may fill out and press a button to add records.
  2. <asp:DataGrid /> show any entered information. To history purposes.

The strange known behavior is, it actually fire ActiveTabChanged twice. In the first time, it act like I'm loading the CustomControl state for the first time and them goes do the event.

I can't use some solution I've seen like set isFormLoaded flag or even fire a javascript postBack function.

I think about placing a IsLoaded flag structured in a ViewState inside the control. And restart it after any fired event inside the custom control.

What do you think about this and there is any solution arround?