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>
Hey Viktor,
My requirement is to load the user control only when the user navigates between the tabs by clicking on a tab. By default, WebTab loads all the user control.I cannot afford loading all the user controls as our controls are extensive in UI and data. We plan to create 4 tabs.
Can this be achieved using the WebTab control? I would appreciate your response!
Hi Tim,
Thank you for report and sample.
That scenario was missed by qa. That had beed fixed and will be available in coming service releases.