Click here to Skip to main content
15,890,717 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Can you please write the code to display this kind of result set in a table in mvc.

SNO  Emp Code  Emp Name           SVP Name            Portfolio  15-Oct-18  16-Oct-18  17-Oct-18  18-Oct-18  19-Oct-18  20-Oct-18  21-Oct-18  Total PRESENT  Total LEAVE  Total WFH
1    8140      Abhishek Dua       Sergey Kolosovskiy  IT         PE         PE         PE         PE         PE         WO         WO         7              0            0
2    9099      Aditya Shishodia   Tarn Shant          IT         PE         PE         PE         PE         PE         WO         WO         7              0            0
3    5564      Ajay Gupta         Sergey Kolosovskiy  IT         WFH        WFH        WFH        WFH        WFH        WO         WO         2              0            5
4    2559      Ajit.yadav         Sergey Kolosovskiy  IT         WO         WO         PE         PE         PE         PN         PN         7              0            0
5    2345      Akash.Jain         Sergey Kolosovskiy  IT         PE         PE         WO         WO         PE         PE         PE         7              0            0
6    8628      Alka Sharma        Sergey Kolosovskiy  IT         PE         PE         PE         PE         PE         WO         WO         7              0            0
7    9976      Aman Kumar Pandey  Tarn Shant          IT         WO         WO         WO         WO         WO         WO         WO         7              0            0


What I have tried:

please help on this.I have storedprocedure which can genrate this kind of resultset . I just want to display on a view in a table.
Posted
Updated 24-Oct-18 9:26am
v2
Comments
j snooze 24-Oct-18 17:52pm    
I certainly am not going to hand out the code and do the work for you, but in my Model, i returned a datatable and then looped through the datatable like you would normally in server side c# on the view. and each column in that row.
foreach (System.Data.DataRow row in Model.Rows){
@for (int c = 1; c < row.ItemArray.Length; c++){ (your data here)}

something like that. Just add a datatable to your model that you return, or just return the datatable as the model your view accepts. Loop through.

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