This is a migrated thread and some comments may be shown as answers.

Multiple controls with the same ID

2 Answers 266 Views
TabStrip
This is a migrated thread and some comments may be shown as answers.
Neil N
Top achievements
Rank 1
Iron
Veteran
Iron
Neil N asked on 17 Mar 2009, 02:18 AM
I'm getting an " Multiple controls with the same ID 'approvalsPending' were found" error with the Q1 2009 tabstrip when clicking a tab with subtabs, clicking another tab, and then clicking the first tab.

Tabstrip definition:

<telerik:RadTabStrip ID="RadTabStrip1" runat="server" OnClientTabSelecting="onTabSelecting" MultiPageID="RadMultiPage1" SelectedIndex="0" Skin="OESskin" EnableEmbeddedSkins="False"
    <Tabs> 
        <telerik:RadTab runat="server" Text="Confirmation" Value="confirmation" />     
         <telerik:RadTab runat="server" Text="Contact" Value="contact" />     
         <telerik:RadTab runat="server" Text="RA Requests" Value="raRequests" > 
         <Tabs> 
            <telerik:RadTab runat="server" Text="Remitters List" Value="chooseRemitters" /> 
            <telerik:RadTab runat="server" Text="Stewards List" Value="chooseStewards" />                        
         </Tabs> 
        </telerik:RadTab>         
         <telerik:RadTab runat="server" Text="Approvals" Value="approvals"
         <Tabs> 
            <telerik:RadTab runat="server" Text="Pending Approvals" Value="approvalsPending" /> 
            <telerik:RadTab runat="server" Text="Requested Approvals" Value="approvalsRequested" />                   
         </Tabs>          
        </telerik:RadTab>            
         <telerik:RadTab runat="server" Text="Approved RA's" Value="approved" /> 
    </Tabs> 
</telerik:RadTabStrip >      
<br /> 
<telerik:RadMultiPage ID="RadMultiPage1" runat="server" SelectedIndex="0" CssClass="multiPage"
</telerik:RadMultiPage> 

Code behind:

    Protected Sub RadMultiPage1_PageViewCreated(ByVal sender As Object, ByVal e As RadMultiPageEventArgs) Handles RadMultiPage1.PageViewCreated 
        Dim userControlName As String = "tabpages\" & e.PageView.ID & ".ascx" 
        Dim userControl As Control = Page.LoadControl(userControlName) 
        userControl.ID = e.PageView.ID & "_userControl" 
        e.PageView.Controls.Add(userControl) 
 
        If (e.PageView.ID <> "chooseRemitters" Or Session("chooseRemitters") = 0) And (e.PageView.ID <> "approvalsPending" Or Session("approvalsPending") = 0) Then 
            CType(userControl, tabpage).loadTab() 
        Else 
            CType(userControl, tabpage).reloadTab() 
        End If 
    End Sub 
 
    Private Sub AddPageView(ByVal tab As RadTab) 
        Dim pageView As RadPageView = New RadPageView 
        pageView.ID = tab.Value 
        RadMultiPage1.PageViews.Add(pageView) 
        tab.PageViewID = pageView.ID 
    End Sub 
 
    Protected Sub RadTabStrip1_TabClick(ByVal sender As Object, ByVal e As RadTabStripEventArgs) Handles RadTabStrip1.TabClick 
        Dim clickedTab As New RadTab 
 
        If e.Tab.Value = "raRequests" Then 
            If RadTabStrip1.FindTabByValue("chooseRemitters").Visible = True Then 
                clickedTab = RadTabStrip1.FindTabByValue("chooseRemitters") 
            Else 
                clickedTab = RadTabStrip1.FindTabByValue("chooseStewards") 
            End If 
        ElseIf e.Tab.Value = "approvals" Then 
            clickedTab = RadTabStrip1.FindTabByValue("approvalsPending") 
        Else 
            clickedTab = e.Tab 
        End If 
 
        AddPageView(clickedTab) 
        clickedTab.PageView.Selected = True 
    End Sub 

I've tried commenting out userControl.ID = e.PageView.ID & "_userControl" and pageView.ID = tab.Value but that didn't help.

STACKTRACE:    at System.Web.UI.Control.FillNamedControlsTable(Control namingContainer, ControlCollection controls)

   at System.Web.UI.Control.FillNamedControlsTable(Control namingContainer, ControlCollection controls)

   at System.Web.UI.Control.FillNamedControlsTable(Control namingContainer, ControlCollection controls)

   at System.Web.UI.Control.EnsureNamedControlsTable()

   at System.Web.UI.Control.FindControl(String id, Int32 pathOffset)

   at System.Web.UI.Control.FindControl(String id)

   at Telerik.Web.UI.RadTabStrip.get_MultiPage()

   at Telerik.Web.UI.RadTab.get_PageView()

   at agreements.RadTabStrip1_TabClick(Object sender, RadTabStripEventArgs e) in D:\My Documents\Visual Studio 2005\WebSites\OES Reporting\agreements.aspx.vb:line 59

   at Telerik.Web.UI.RadTabStrip.RaiseEvent(Object eventKey, RadTabStripEventArgs e)

   at Telerik.Web.UI.RadTabStrip.OnTabClick(RadTabStripEventArgs e)

   at Telerik.Web.UI.RadTabStrip.RaisePostBackEvent(String eventArgument)

   at Telerik.Web.UI.RadTabStrip.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument)

   at System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument)

   at System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData)

   at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)


Line 59 is: clickedTab.PageView.Selected = True


2 Answers, 1 is accepted

Sort by
0
Paul
Telerik team
answered on 17 Mar 2009, 01:03 PM
Hi Neil,

This can occur only if some of your controls' IDs are duplicate (PageView id or user control id) or if a pageview/UserControl is added twice on the page. Still, It will be best if you can open a support ticket and send us a simple running project (incl. your custom skin, CSS, images, DB backup if needed and so on) demonstrating the problem (and step-by-step instructions on doing so). In that way we can reproduce and pinpoint the problems you're facing on our side, understand the logic of your application and provide a solution.

Regards,
Paul
the Telerik team


Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Neil N
Top achievements
Rank 1
Iron
Veteran
Iron
answered on 17 Mar 2009, 01:29 PM
Got a fix, recording it here if anyone else has the same problem (since I copied the code from a Telerik demo):

    Private Sub AddPageView(ByVal tab As RadTab) 
        Dim pageView As RadPageView = New RadPageView 
        pageView.ID = tab.Value 
        If IsNothing(RadMultiPage1.FindPageViewByID(tab.Value)) Then  'add page view only if it not already there 
            RadMultiPage1.PageViews.Add(pageView) 
        End If 
        tab.PageViewID = pageView.ID 
    End Sub 

Tags
TabStrip
Asked by
Neil N
Top achievements
Rank 1
Iron
Veteran
Iron
Answers by
Paul
Telerik team
Neil N
Top achievements
Rank 1
Iron
Veteran
Iron
Share this question
or