从视图中的数据生成html页面的最佳方法是什么?我有一个包含所有表格等的html模板.不想使用像JqueryTemplate这样的任何模板.
我得到这个:
private object setReportValues(object report, FormCollection values)
{
PropertyInfo[] properties = report.GetType().GetProperties();
foreach (PropertyInfo property in properties)
{
string val = values.GetValue(property.Name).ToString();
property.SetValue(report, val, null);
}
return report;
}
Run Code Online (Sandbox Code Playgroud)
异常开启string val = values.GetValue(property.Name).ToString();。我之前必须检查空值吗?