Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/263.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 使用Telerik网格绑定Asp.net MVC的动态列_C#_Asp.net_Asp.net Mvc_Asp.net Mvc 4_Telerik - Fatal编程技术网

C# 使用Telerik网格绑定Asp.net MVC的动态列

C# 使用Telerik网格绑定Asp.net MVC的动态列,c#,asp.net,asp.net-mvc,asp.net-mvc-4,telerik,C#,Asp.net,Asp.net Mvc,Asp.net Mvc 4,Telerik,我有一个这样的模型 public class product { int ProductId {get;set;} List<attributes> attributes {get;set;} } public class attributes { public string Data Type{get;set;} public string Value{get;set;} } 公共类产品 { int ProductId{get;set;

我有一个这样的模型

public class product 
{ 
  int ProductId {get;set;} 
  List<attributes> attributes {get;set;} 
} 

public class attributes 
{ 
    public string Data Type{get;set;}
    public string Value{get;set;} 
}
公共类产品
{ 
int ProductId{get;set;}
列表属性{get;set;}
} 
公共类属性
{ 
公共字符串数据类型{get;set;}
公共字符串值{get;set;}
}
我想将模型生成一个MVC网格,属性是列和属性数,数据类型仅在运行时获取


有人知道吗?请让我知道……

获取属性的计数,并为如下所示编写一个

  for (int i = 0; i < (Selected.Selected.Count()); i++)
    {
        string columnName = Selected.Selected[i].Name;
        columns.Template(m => m.Getvalue(columnName)).Title(columnName);
    }
for(int i=0;i<(Selected.Selected.Count());i++)
{
string columnName=已选定。已选定[i]。名称;
columns.Template(m=>m.Getvalue(columnName)).Title(columnName);
}
在模型中编写一个返回值为
公共字符串Getvalue(字符串columnName) { return”“+Value+//您需要在网格上显示的内容在此生成

}

这是带有MVC包装的剑道UI还是Telerik MVC扩展(已停止)?只有Telerik MVC扩展(已停止)将得不到任何答案,但我会修复它。。