如何将包含空格的标题列名添加到我的asp.net mvc webgrid?有人会对此提出一些想法吗?
var str= "ProjectID,ProjectTitle,ProjectDescription";
var headers = "Project ID,Project Title,Project Description";
string[] columns = str.Split(',');
string[] hdrs = headers.Split(',');
var cols = new List<WebGridColumn>();
foreach (var column in columns)
{
cols.Add(grid.Column(column));
}
@grid.GetHtml(columns: cols)
答案 0 :(得分:1)
cols.Add(grid.Column(columnName: "column", header: "Column Name With Spaces"));