tab container - event is not firing

2019-07-08 23:26发布

问题:

i am creating a tab container at runtime and make 1 of the column member as the tab header once user click on the tab i want to fire the event ActiveTabChanged.. if autopostback=true the entire tab container will gone but it got commend inside the event. if autopostback=false it can't go in the event and nothing happen at the layout.. hence i change the concept of my code..what i want is when user click on tab.. event are fire > everything remain same > next asp.net function will be call from the event. below are my coding Remark- TabC is the tab container

<script type="text/javascript">
    function ActiveTabChanged(sender, e) {
        var Current_Tab = $get('<%#TabC.ClientID%>');

        Current_Tab.innerHTML = sender.get_activeTab().get_headerText();

        __doPostBack('TabC', sender.get_activeTab().get_headerText());
        //Highlight(TabC);
    }
</script>

in the body

 <asp:TabContainer ID="TabC" 
    runat="server" 

    OnClientActiveTabChanged="ActiveTabChanged"  
    OnActiveTabChanged="ActiveTabChangedServer"
    ActiveTabIndex="0" 
/>

at Page Load

UpdatePanel oUpdatePanel = new UpdatePanel();
    AsyncPostBackTrigger trigger = new AsyncPostBackTrigger();

 protected void Page_Load(object sender, EventArgs e)
    {
        trigger.ControlID = "TabC";
        trigger.EventName = "ActiveTabChanged";
        oUpdatePanel.Triggers.Add(trigger);

        Page.Header.DataBind();

        ScriptManager.RegisterAsyncPostBackControl(TabC);

        if (!Page.IsPostBack)
        {
            //runtime generate tab and gridview
            Bind_Category_with_Tab();
        }
    }

error i get

output

the main problem is.. when i fire any event of the component in the page every things will disappear.. if the event can be trigger (AutoPostBack="true") what mistake i have been done here? please to give a help here.. thanks advance