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

Trying to bind multiple GridViews inside RadPanelBar

2 Answers 84 Views
PanelBar
This is a migrated thread and some comments may be shown as answers.
Laurie
Top achievements
Rank 2
Laurie asked on 11 May 2009, 08:39 PM
I'm trying to bind a gridview inside a RadPanelBar.  My initial aspx code is somewhat like this:

 

<telerik:RadPanelBar ID="rpbSections" runat="server">

 

<Items>

 

 

<telerik:RadPanelItem runat="server">

 

<Items>

 

<telerik:RadPanelItem runat="server">

 

<ItemTemplate>

 

<asp:GridView ID="gvPlanContents" runat="server" AutoGenerateColumns="True"

 

DataKeyNames="PlanContentID" HorizontalAlign="Center" Width="60%" ShowHeader="true"

 

EmptyDataText="No Data here">

 

</asp:GridView>

 

</ItemTemplate>

 

</telerik:RadPanelItem>

 

</Items>

 

</telerik:RadPanelItem>

 

</Items>

 

</telerik:RadPanelBar>

My code starts something like this:

 

List<PlanSections> mySections = PlanSections.GetAllPlanSections();
rpbSections.DataSource = mySections;

 

 

rpbSections.DataValueField =

"PlanSectionID";

 

 

rpbSections.DataTextField =

"PlanSectionName";

 

 

rpbSections.DataBind();

 


 

for (int i = 0; i < rpbSections.Controls.Count; i++)

 

 

 {

 

 

    int mySectionID = Convert.ToInt32(rpbSections.Items[i].Value);

 

 

   // what I need to know is, what code do I use to access the gridview.  I want to bind it for each
    // of its instantiations, by generating an object that depends on the value of MySectionID.
    // Where do I go from here?
}

Thanks!

Laurie

 

 

 

2 Answers, 1 is accepted

Sort by
0
Paul
Telerik team
answered on 12 May 2009, 07:59 AM
Hello Laurie,

The FindControl method provides you with a reference to any control inside any of the templates used in the RadPanelBar or any of its PanelItems. You have to make sure that you properly typecast the returned value as FindControl returns a reference to a Control class.

For details on the matter please refer to this example.

Greetings,
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
Laurie
Top achievements
Rank 2
answered on 04 Nov 2009, 06:21 PM
I'm moving this into a support ticket.  Will update once it's resolved.
Tags
PanelBar
Asked by
Laurie
Top achievements
Rank 2
Answers by
Paul
Telerik team
Laurie
Top achievements
Rank 2
Share this question
or