Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
40
UserControl URL not loading on button click
posted

Trying to get usercontrol URL's to load on a button click event.  When I click the button, the tab is created, but the usercontrol is not loaded into the tab.  If I create a static tab in the aspx page, then the user control will load.

 

protected void Button1_Click(object sender, EventArgs e)
        {
            ContentTabItem Tab = new ContentTabItem();
            Tab.Text = "hello world";                       
            Tab.UserControlUrl = "Test1.ascx";
            Tab.DataBind();
            WebTab1.Tabs.Add(Tab);
            WebTab1.DataBind();           
        }

 

 <asp:UpdatePanel ID="UpdatePanel1" runat="server">
    <ContentTemplate>

    <asp:Button ID="Button1" runat="server" Text="Button" onclick="Button1_Click" />

<ig:WebTab ID="WebTab1" runat="server" Height="800px" Width="860px" TabOrientation="Horizontal" TabLocation="TopLeft" SelectedIndex="0" EnableActivation="true" StyleSetName="Office2007Blue" EnableEmbeddedJavaScript="true">  
            <AddNewTabItem Enabled="true" TextForNewTab="Untitled" EnableTextEditingOnDoubleClick="true"  /> 
            <CloseButton Enabled="true" />
            <PostBackOptions EnableAjax="true" EnableLoadOnDemand="true" EnableLoadOnDemandUrl="true" />            
            <ClientEvents TabAdded="TabAddedHandler" />
            <AjaxIndicator Enabled="True" Location="MiddleCenter" />


            <Tabs>
                <ig:ContentTabItem runat="server" Text="Tab 1">
                    <Template>
                        <asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>
                        <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
                    </Template>                   
                </ig:ContentTabItem>
                <ig:ContentTabItem runat="server" Text="Tab2" UserControlUrl="~/Test1.ascx" >            
                </ig:ContentTabItem>                           
            </Tabs>
        </ig:WebTab>

    </ContentTemplate>
    </asp:UpdatePanel>