Click here to Skip to main content
15,886,137 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
See more:
I create a Webgrid in MVC4 to show a table data, and works perfect but i want to create a webgrid that work for any table means number of column should not be hard coded and column name should be table's column name. How i can do it?
Posted
Updated 2-Dec-13 21:01pm
v2

See solution here

how to create model at run time?[^]
 
Share this answer
 
You have to return the HTML helper for that. The same html code you have to generate dynamically and what ever hard coded values in your grid will be passed dynamically to helper as input parameters.
Please check the below link for reference creating HTML helper in MVC
http://www.asp.net/mvc/tutorials/older-versions/views/creating-custom-html-helpers-cs[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900