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

[Solved] Children inside same row as parent

1 Answer 60 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Kristof
Top achievements
Rank 1
Kristof asked on 28 May 2009, 09:11 PM
I would like to know how I can show the child items from a class in the same row as the parent object.

Take this for example:
I fill up the radgrid by binding the grid to a datasource which is a list of Owner items.
Each owner item has a list containing 2 pet items.

How do I show these in the same row in the grid?
eg: column1 show the name of the owner, column 2 shows the name of the first pet ( =list[0].petname) and column 3 shows the name of the second pet ( =list[1].petname). I don't enable viewstate because it needs to get bound each time.

at the moment i have something like the following:

<

 

telerik:RadPageView ID="rpvOwnerAndPets" runat="server">
<telerik:RadGrid ID="rgOwnerAndPets" runat="server" OnNeedDataSource="rgOwnerAndPets_NeedDataSource"

 

 

GridLines="None" BorderWidth="0px" CellPadding="0" ShowHeader="False" OnItemCommand="rgOwnerAndPets_ItemCommand"

 

 

AllowMultiRowEdit="True" OnItemCreated="rgOwnerAndPets_ItemCreated">

 

 

<MasterTableView Width="100%" AllowMultiColumnSorting="false" EditMode="InPlace">

 

 

<ItemTemplate>

 

 

<asp:HiddenField ID="hfOwnerName" runat="server" Value='<%# Bind("OwnerName") %>' />

 

 

<asp:HiddenField ID="hfPetName1" runat="server" Value='<%# Bind("Pets[0].OwnerName") %>' />

 

 

<asp:HiddenField ID="hfPetName1" runat="server" Value='<%# Bind("Pets[1].OwnerName") %>' />
...

Could someone help me out?

Grts!

 

1 Answer, 1 is accepted

Sort by
0
Nikolay Rusev
Telerik team
answered on 29 May 2009, 06:57 AM
Hello Kristof,

Please find the attached project. It demonstrates scenario similar to what you have described in your post.

Hope that helps.

Regards,
Nikolay
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.
Tags
Grid
Asked by
Kristof
Top achievements
Rank 1
Answers by
Nikolay Rusev
Telerik team
Share this question
or