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.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Pradeep ShetRank #595 · 4K reputationPosted Apr 14, 2015, 11:35 AM EDT
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,