开发者

AjaxControlToolkit TabContainer ActiveTabChanged event fired twice when UpdatePanel and ToolkitScriptManager is used?

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:开发者_JAVA技巧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?


I couldn't solve this problem because it comes from the internal mechanics of this component. I wouldn't go through that jungle. So I asked a designer to draw cool tabs for me and wrote my own tab control using AJAX and Rest Services style. That's it! The behavior I wanted now I have it and works pretty nice now; controllable and loads less JavaScript code into the client machine. Stop using that shit!

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜