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

[Solved] Is there any way to create my own GridViewRow with GridViewCell?

1 Answer 118 Views
GridView
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
King Chan
Top achievements
Rank 1
King Chan asked on 18 Oct 2010, 08:17 PM
Hello Telerik Staff,

What I want to do is....create a GridViewRow, with each cell binding to different objects's different property.
Say, my GridView have 3 Columns.
So the GridViewRow should have 3 cells:
Cell[0]'s content maybe Class1Obj's.Text
Cell[1]'s content maybe Class2Obj's.Date
Cell[2]'s content maybe Class2Obj's.isChecked

So is there any way I can do that? Using GridView like a table, and fill in each cell's content myself?
I don't want to create a List<DataObject> to let GridView to populate the list.
Because each row will be mix with different class's objects and columns will be dynamically created.

Edit:
I tried to do something like,
GridViewRow aGridViewRow = new GridViewRow();
GridViewCellBase aGridViewCell = new GridViewCellBase();            
aGridViewCell.Name = "Hello";            
aGridViewCell.Content = "123";
GridViewCellBase aGridViewCell2 = new GridViewCellBase();
aGridViewCell2.Name = "Hello2";
aGridViewCell2.Content = "123";
aGridViewRow.Cells.Add(aGridViewCell);
aGridViewRow.Cells.Add(aGridViewCell2);
And add it to GridView with GridView.Items.Add(aGridViewRow);
But.... I guess this is not the way to doing it? Because I only get an empty row but nothing else....

Thanks,
King

1 Answer, 1 is accepted

Sort by
0
Milan
Telerik team
answered on 20 Oct 2010, 03:46 PM

Hello King Chan,

Well, the grid has to be bound to some sort of data. Setting the data for each cell manually will be quite cumbersome and will result in low performance. 

You have mentioned that your data is dynamic and you might find our Silverlight DataTable quite helpful to get your project started. 



Sincerely yours,
Milan
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Tags
GridView
Asked by
King Chan
Top achievements
Rank 1
Answers by
Milan
Telerik team
Share this question
or