开发者

MVC Reporting - a generic View which will display headers and results irrespective of number of columns in Model

开发者 https://www.devze.com 2023-01-13 03:24 出处:网络
for any new report requirement - 1] We will copy existing page, change sql,add authorisation and Done. This activity doesn\'t take more than half an hour.

for any new report requirement -

1] We will copy existing page, change sql, add authorisation and Done. This activity doesn't take more than half an hour.

2] or add IF else block in the existing page.

However in MVC world, I have Controller Action - which will return model to view.

And in View - Result and Headers will be displayed using <% foreach (var item in Model) %>

Here I want a generic View which will displ开发者_运维百科ay headers and results irrespective of number of columns in Model.

Any suggestions?


How about having the following model:

public class MyModel
{
    public IEnumerable<string> Headers { get; set; }
    public IEnumerable<string> Values { get; set; }
}

Then you could loop through the headers and values in your view to display them.

0

精彩评论

暂无评论...
验证码 换一张
取 消