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

RadGrid as a User Control

1 Answer 24 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Ajay
Top achievements
Rank 2
Ajay asked on 19 Jun 2014, 12:39 PM
I am having multiple radgrids in my application.So, Is this possible that by defining a radgrid in a user control, it could be made generic.And can be simply used instead of those multiple grids.However in the grids the column count and name varies in some grids.I checked online for this, but there it was about programmatic creation of grids.

If it is possible, kindly mail me a sample code.

1 Answer, 1 is accepted

Sort by
0
Angel Petrov
Telerik team
answered on 24 Jun 2014, 08:40 AM
Hello Ajay,

In order to make things generic you can populate the grid in the NeedDataSource event handler and set its AutoGenerateColumns property to true. That way the number of columns and the fields to which they are bound will be determined by the data source passed in the event handler. That said the only thing left to do is to construct a method which to return a different source for the grid(which depends on the specific requirements) and call it in the NeedDataSource event.

Regards,
Angel Petrov
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
Tags
General Discussions
Asked by
Ajay
Top achievements
Rank 2
Answers by
Angel Petrov
Telerik team
Share this question
or