如何从现有列表中填充GridPanel? [英] How to fill GridPanel from existing list?
本文介绍了如何从现有列表中填充GridPanel?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我已经返回了List< warning>类的列表来自控制类,如下所示:
I have returned a list of classes List<warning> from the control class like this:
public ActionResult Ex3()
{
List<warning> warningsList = new List<warning>();
XElement xelem = XElement.Load(transformedFile);
var warnings = from elem in xelem.Descendants("warning")
select elem;
foreach (var v in warnings)
{
warning warn = new warning();
warn.id = v.Attribute("id").Value;
warningsList.Add(warn);
}
return View(warningsList);
}
i创建了一个带有创建强类型视图选项的视图,我选择了警告类作为模型。
现在,在Ex3View.cshtml中,我想用warningsList中的值创建并填充gridpannel。请注意,视图文件是.cshtml而不是.aspx。
i have created a view with the option "create a strongly typed view" and i have choose the warning class as a model.
Now, in Ex3View.cshtml, i want to create and fill a gridpannel with the values in the warningsList. Please note that the view file is .cshtml and not .aspx.
推荐答案
这篇关于如何从现有列表中填充GridPanel?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文