Hi guys,
Actually i want to display data in MVC(webgrid) using stroed procedure.
how to write code in controller.
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Pradeep ShetPosted Apr 14, 2015, 3:35 PM
1) First Create a model class
In Controller class, create a action method
2)Execute the procedure using SqlConnection & SqlDataAdapter and fetch the data in dataset
3)Map the model class properties with datatable columns.
4)Return a view along with mapped model (which would be your strongly type list) from action method
5)In View (which is also a strongly typed) create a webgrid instance and pass the Model as parameter.
Thats it.For reference
http://www.codeproject.com/Articles/843788/WebGrid-in-ASP-NET-MVC-important-tips
Please mark it as answered if it helped you,