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

[Solved] Programmatic Runtime MVC Grid creation

1 Answer 65 Views
Grid
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Maninderjit
Top achievements
Rank 1
Maninderjit asked on 04 Nov 2010, 12:09 AM
Hi,
Is there any way that we can programmatically create MVC grid at run-time? I am trying to create a very Generic Grid that takes any Model class (IEnumerable<T> obj) as one of the parameters and then create a grid. Something like:

public

 

 

MvcHtmlString Grid<T>(... , IEnumerable<T> items, ...) where T : class
{ 

 

 

var

 

 

grd = _html.Telerik().Grid<T>(items).Name(name).Sortable().Pageable(paging => paging.PageSize(pageSize).Style(GridPagerStyles.NextPreviousAndNumeric).Position(GridPagerPosition.Bottom)).Scrollable();

 

 

 

 

......
create the grid here (Is it possible to build grid having both Bound and Template columns?)
......
var grid = grd.ToComponent();
return new MvcHtmlString(grid.ToHtmlString());

Thanks in advance!

 

 

 

 

 

 

}

 

 

1 Answer, 1 is accepted

Sort by
0
Praveen Addepally
Top achievements
Rank 1
answered on 23 Feb 2012, 12:13 AM
I'm also looking for similar solution. Is this possible to create a MVC Telerik grid from Scratch using C# ?


Thank you.
Tags
Grid
Asked by
Maninderjit
Top achievements
Rank 1
Answers by
Praveen Addepally
Top achievements
Rank 1
Share this question
or