I have a Set of tabs(5 total), each tab has a listview on it. Control works fine when switching tabs and loading data. The problem arrises when I try to change the selected tab when the user first request the page and has a value in the request url. Example MYPage.aspx?t=3, so the page defaults to tab 3 instead of the first tab. The error the pops up is the listview on the tab doesn't exist
The error I get says it can't find the listview control on the page...
Error Message
IPageableItemContainer 'listview3' not found. Description: An unhandled exception occurred during the execution of the current web request. Exception Details: System.InvalidOperationException: IPageableItemContainer 'listview3' not found.
Sample Code in page_init
If Not Request.Item("t") Is Nothing Then If IsNumeric(Request.Item("t")) Then WebTab1.SelectedIndex = CInt(Request.Item("t")) End If Else WebTab1.SelectedIndex = 0 End If
Strip down sample of webtab, I have removed the tabs/control in tab since the code is huge.
HTML/Control
<ig:WebTab ID="WebTab1" runat="server" Height="550px" Width="100%" onselectedindexchanged="WebTab1_SelectedIndexChanged" StyleSetName="Default"> <tabs> </tabs> <PostBackOptions EnableLoadOnDemandUrl="true" EnableLoadOnDemand="true" EnableReloadingUnselectedTab="true" EnableAjax ="true"/> <AutoPostBackFlags SelectedIndexChanged ="On"/> </ig:WebTab>
I am hoping I am just setting the active tab wrong, or at the wrong time, or there is something else I am missing.
Hi Rob,
As far as I understand, this might be a problem with the page life cycle in which the WebTab resides. Your sample code in page_init I think should be implemented during page load and not during its initialization when the controls are loaded.
If you are working in C#, you can try this in the Target page's behind code:
protected void Page_Load(object sender, EventArgs e) { string s = Request.QueryString["t"]; if (s != null) { WebTab1.SelectedIndex = int.Parse(s); } else { WebTab1.SelectedIndex = 0; } }
Regards
Moved the logic to Page_Load but getting the same error.
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
If Not Page.IsPostBack Then 'First Load If Not Request.Item("t") Is Nothing Then If IsNumeric(Request.Item("t")) Then WebTab1.SelectedIndex = CInt(Request.Item("t")) End If Else WebTab1.SelectedIndex = 0 End If
Else 'Post Back
End If
End Sub