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

Inherit from GridViewTemplate

1 Answer 104 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Marco
Top achievements
Rank 2
Veteran
Marco asked on 20 Jul 2015, 12:38 PM

Hi Telerik team.

I have a question about the RadGridView. I use in my application multiple gridview which have in common a lot. I have made some class which inherit from GridViewTemplate to represent my buisness object. This let me use the same grid in multiple Template.

But I have tried to go to the next step in using these Template on a hierarchical Grid (by extending them to add one column for the relation with the parent grid). And then I came in trouble because the template on the main level should be a MasterGridViewTemplate (or inherit from it) and the secondary template should be a GridViewTemplate (or inherit from it BUT not from MasterGridViewTemplate).

Let see an example:

I have two business object with one hierarchical: Customer and order.

I create two class CustomerGridViewTemplate and OrderGridViewTemplate which inherits from MasterGridViewTemplate. I can use theses template to build  grid which show a list of customer or a list of order.

Now, I want to build a hierarchical Grid which show customer and their relative order so I create a new class CustomerOrderGridViewTemplate which inherits from OrderGridViewTemplate (it just add a new column with client ID). I use the CustomerGridViewTemplate as MasterTemplate and I add the CustomerOrderGridViewTemplate in the template collection and create a relation. This doesn't work (only the master template display). If OrderGridViewTemplate inherits from GridViewTemplate instead of MasterGridViewTemplate the two grid display correctly but I can't use anymore OrderGridViewTemplate in other Grid as MasterTemplate.

I don't understand why a custom template inheriting from MasterGridViewTemplate couldn't be used as secondary template. Any help or explanation will be welcome.

1 Answer, 1 is accepted

Sort by
0
Hristo
Telerik team
answered on 23 Jul 2015, 11:59 AM
Hello Marco,

Thank you for writing.

RadGridView is designed to work with only one when there is hierarchical data the type of the inner templates needs to be GridViewTemplate. These two classes are different and the latter one contains implementation specific to displaying a single level of hierarchical data.

Additional information is provided in the following documentation article: http://www.telerik.com/help/winforms/gridview-fundamentals-overview-of-radgridview-structure.html

I hope this information is useful. Should you have further questions please do not hesitate to write back.

Regards,
Hristo Merdjanov
Telerik
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 Feedback Portal and vote to affect the priority of the items
Tags
GridView
Asked by
Marco
Top achievements
Rank 2
Veteran
Answers by
Hristo
Telerik team
Share this question
or