显示在运行时asp.net mvc的电网动态选择列 [英] show dynamically selected columns in asp.net mvc grid at runtime

查看:111
本文介绍了显示在运行时asp.net mvc的电网动态选择列的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在那里我使用Telerik的网格显示数据的asp.net MVC应用程序/ records.I现在用的是实体模型。

我的要求是,有时我想只显示部分在运行时指定的列/可用户选择。我如何绑定视图仅具有由用户选择列。最初观点是绑定与所有列Model类。

有比Telerik的展现定制的列以外的任何其他方式由用户选择的
那么这将是还行。


解决方案

 <%= Html.Telerik()
    .Grid(Model.Customers)
    。名称(网格)
    .Columns(列=>
    {
        columns.Bound(客户=> customer.FirstName)。可见(Model.IsShowFirstName);
        columns.Bound(客户=> customer.LastName)。可见(Model.IsShowLastName);
    })
%GT;

I have an asp.net MVC application where I am using telerik grid to show the data/records.I am using the Entity Model.

My requirement is that sometime I want to show only some of the columns specified at the runtime/may the user select. How do I bind View with only those columns as selected by the user . Initially view is binded with Model class with all columns .

Is there any other way other than telerik to show the customized columns as selected by the user then it will be also OK .

解决方案

<%= Html.Telerik() 
    .Grid(Model.Customers) 
    .Name("Grid") 
    .Columns(columns => 
    { 
        columns.Bound(customer => customer.FirstName).Visible(Model.IsShowFirstName); 
        columns.Bound(customer => customer.LastName).Visible(Model.IsShowLastName); 
    }) 
%>

这篇关于显示在运行时asp.net mvc的电网动态选择列的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆