RadGrid as a User Control

2 posts, 0 answers
  1. Ajay
    Ajay avatar
    3 posts
    Member since:
    Feb 2014

    Posted 19 Jun 2014 Link to this post

    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.
  2. Angel Petrov
    Admin
    Angel Petrov avatar
    1006 posts

    Posted 24 Jun 2014 Link to this post

    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.

     
Back to Top