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
Hopefully the following info will help someone else. I was finally able to determine why I couldn't set the SelectedIndex on pageload. It's definitely a Infragistics bug, but at least I figure it out and found a way around it.
The Problem... a review
On each of the tabs I had there was a just a listview control, whenever I tried to specify the tab it would say it couldn't find this control "IPageableItemContainer 'listview' not found" and the page would bomb.
Work Around ... the real problem
I figured out it wasn't the listview, it was the datapager above the listview. The datapager refers to the listview, but apparently something it not loading properly when I set the selectedindex server side. If I remove the pager or move the pager to be only under the listview the selectedindex setting works. Its not a perfect fix since I always have my paging at the top and bottom of listviews but at least there is a work around.
Hopefully someone from Infragistics can reproduce this problem now that I have more info and can fix it.
<asp:DataPager ID="datapageernamehere" runat="server" PagedControlID="listviewnamehere" PageSize="20"> <Fields> <asp:NumericPagerField ButtonType="Link" /> </Fields> </asp:DataPager>