我想实现显示和编辑查找表/应用程序级变量一个ListView数据控制。有多个实体类可以绑定到ListView,因此需要将ItemTemplate动态绑定到选定的实体对象。Asp.NET的ListView数据控制动态数据绑定
,比如我有:
AddressType { AddressTypeId, AddressTypeDescription},
PhoneType { PhoneTypeId, PhoneType},
MarriageStatusType { MarriageStatusId, marriageStatusType}
这些生成的实体对象阻止我只做类似于下面的代码片段,因为ID和类型属性是每个业务对象上不同。
<ListView>
...
<itemTemplate>
<tr>
<td runat="server" id="tdId"> <%# Eval("ID") %> </td>
<td runat="server" id="tdType"> <%# Eval("TypeNameDescription") %> </td>
</tr>
</itemTemplate>
...
</ListView>
我试图发现: 1.如何遍历的ListView项目中插入相应的属性值到服务器端的HTML标签的TD。 2.如何在ListView项上使用Databinder.Eval来插入该属性值。
在此先感谢!