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

Dynamic Tabs, PageViews, Contents And UserControls

4 Answers 116 Views
TabStrip
This is a migrated thread and some comments may be shown as answers.
Virgil Rodriguez
Top achievements
Rank 1
Virgil Rodriguez asked on 07 Feb 2011, 11:55 PM
Hello Telerik,

I have this in my .ASPX page:

<div id="divTabs" runat="server">
    <telerik:RadTabStrip ID="rtsArticles" runat="server" SelectedIndex="0" MultiPageID="rmpArticles" Skin="Default" Width="100%">
      </telerik:RadTabStrip>
      <telerik:RadMultiPage ID="rmpArticles" runat="server" SelectedIndex="0" Height="100%" Width="100%">
      </telerik:RadMultiPage>
</div>
<div id="divGroups" runat="server">
    <asp:Panel ID="pnlGroups" runat="server">
        <asp:Repeater ID="rptGroups" runat="server" EnableTheming="True" OnItemDataBound="GroupRepeater_ItemDataBound">
            <ItemTemplate>
                    <div id="divDivGroups" runat="server" style="border-bottom:1px dashed silver;">
                     <asp:Label ID="hlGroups" runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "group_text") %>'></asp:Label>
                    </div>
            </ItemTemplate>
        </asp:Repeater>
    </asp:Panel>
</div>

I am trying to create dynamic Tabs in a single Tabstrip that points to dynamic PageViews in a single MultiPage with the dynamic PageViews pointing to dynamic Contents within dynamic UserControls.

I have this in my code behind:

Protected Sub GroupRepeater_ItemDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.RepeaterItemEventArgs)
Dim item As RepeaterItem
  item = e.Item
  Dim userCtrl As HtmlControl = item.FindControl("divDivGroups")
  If item.ItemType = ListItemType.Item Or item.ItemType = ListItemType.AlternatingItem Then
        Dim strGroupNumber As String = item.DataItem("group_id").ToString
        Dim tab As New RadTab
        Dim rtsArticles As RadTabStrip
        Dim rpageView As New RadPageView
        Dim rmpArticles As RadMultiPage 
        tab.Text = strGroupNumber
        tab.PageViewID = "rpv" & strGroupNumber
        rtsArticles = item.Parent.Parent.Parent.Parent.FindControl("divTabs").FindControl("rtsArticles")
        rtsArticles.Tabs.Add(tab)
        rpageView.ID = "rpv" & strGroupNumber
        userCtrl.ID = "divUser" & strGroupNumber
        rmpArticles = item.Parent.Parent.Parent.Parent.FindControl("divTabs").FindControl("rmpArticles")
        rpageView.Controls.Add(userCtrl)
        rmpArticles.PageViews.Add(rpageView)
    End If
End Sub

I can't seem to make it work.

Any ideas, suggestions, feedback or sample application would be much appreciated.

Thanks in advance,

Virgil Rodriguez


4 Answers, 1 is accepted

Sort by
0
Yana
Telerik team
answered on 10 Feb 2011, 02:50 PM
Hello Virgil,

Please check our example here which demonstrates the needed approach.

Greetings,
Yana
the Telerik team
Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
0
Virgil Rodriguez
Top achievements
Rank 1
answered on 10 Feb 2011, 05:59 PM
Hi Yana,

Thanks for the reply. Unfortunately, the example does not fit my requirements.

The example has fixed and ready-to-go files (Customer.ascx, Product.ascx  and Order.ascx ).

In my case, the page view content "divDivGroups" is still to be dynamically built when "GroupRepeater_ItemDataBound" executes. And while these are being built, I am also building my RadMultiPage and my RadTabStrip.

My main problem is, I am encountering the error: "Multiple controls with the same ID ... were found. FindControl requires that controls have unique IDs".

How do I get around this?

Thanks,
Virgil
0
Yana
Telerik team
answered on 11 Feb 2011, 09:05 AM
Hi Virgil,

Which version of the controls exactly you're using? We had a similar issue in one of the oldest releases.

All the best,
Yana
the Telerik team
Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
0
Virgil Rodriguez
Top achievements
Rank 1
answered on 15 Feb 2011, 03:51 PM
Hi Yana,

The version I'm using is Version=2008.2.826.20.

But I was able to fix the problem. It had something to do with creating unique IDs, so I just had a counter that would create a unique number for each element of my repeater.

Thanks for your time.

Regards,
Virgil


Tags
TabStrip
Asked by
Virgil Rodriguez
Top achievements
Rank 1
Answers by
Yana
Telerik team
Virgil Rodriguez
Top achievements
Rank 1
Share this question
or