asp.net 的数据集合绑定方法 DataBinder.Eval 不好用,不支持子实体绑定,不支持枚举转义绑定等等,总之不是很好用,只好自己丰衣足食,
组件下载:https://files.cnblogs.com/zhouyongguo/testLogon.rar
页面html代码式:
<table border=1>
<tr>
<td>名称</td>
<td>审核</td>
<td>日期</td>
<td>其他</td>
</tr>
<asp:repeater id="Repeater1" runat="server">
<ItemTemplate>
<tr>
<td><%#Great.MyBinder.Eval(Container.DataItem,"Title")%></td>
<td><%#Great.MyBinder.EvealEnum(Container.DataItem,"IsAuditing",new string[]{"审核","未审核"})%></td>
<td><%#Great.MyBinder.EvalDate(Container.DataItem,"CreateDate",true)%></td>
<td><%#Great.MyBinder.Eval(Container.DataItem,"file.Name")%></td>
</tr>
</ItemTemplate>
</asp:repeater>
</table>
<%#Great.MyBinder.Eval(Container.DataItem,"file.Name")%><%#Great.MyBinder.Eval(Container.DataItem,"file.Name")%><%#Great.MyBinder.Eval(Container.DataItem,"file.Name")%><%#Great.MyBinder.Eval(Container.DataItem,"file.Name")%><%#Great.MyBinder.Eval(Container.DataItem,"file.Name")%><%#Great.MyBinder.Eval(Container.DataItem,"file.Name")%><%#Great.MyBinder.Eval(Container.DataItem,"file.Name")%><%#Great.MyBinder.Eval(Container.DataItem,"file.Name")%>file.Name 可以一直点下去 如:file.Name...,可以绑定私有字段,枚举 布尔可以转义
代码:
实体:
public class Doc
{
string _title="";
public string Title
{
get{return this._title;}
set{this._title=value;}
}
![](/Images/OutliningIndicators/InBlock.gif)
public File file;
![](/Images/OutliningIndicators/InBlock.gif)
private System.DateTime CreateDate=System.DateTime.Now;
![](/Images/OutliningIndicators/InBlock.gif)
public bool IsAuditing=false;
public Doc()
{
}
![](/Images/OutliningIndicators/InBlock.gif)
public Doc(System.DateTime createDate)
{
CreateDate=createDate;
}
}
![](/Images/OutliningIndicators/None.gif)
public class File
{
private string Name="";
public File(string name)
{
this.Name=name;
![](/Images/OutliningIndicators/InBlock.gif)
}
}
组件下载:https://files.cnblogs.com/zhouyongguo/testLogon.rar
页面html代码式:
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/ExpandedBlockStart.gif)
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/None.gif)
<%#Great.MyBinder.Eval(Container.DataItem,"file.Name")%><%#Great.MyBinder.Eval(Container.DataItem,"file.Name")%><%#Great.MyBinder.Eval(Container.DataItem,"file.Name")%><%#Great.MyBinder.Eval(Container.DataItem,"file.Name")%><%#Great.MyBinder.Eval(Container.DataItem,"file.Name")%><%#Great.MyBinder.Eval(Container.DataItem,"file.Name")%><%#Great.MyBinder.Eval(Container.DataItem,"file.Name")%><%#Great.MyBinder.Eval(Container.DataItem,"file.Name")%>file.Name 可以一直点下去 如:file.Name...,可以绑定私有字段,枚举 布尔可以转义
代码:
1
private void Page_Load(object sender, System.EventArgs e)
2
{
3
this.Repeater1.DataSource=GetList();
4
this.Repeater1.DataBind();
5
}
6![](/Images/OutliningIndicators/None.gif)
7
private ArrayList GetList()
8
{
9
System.Collections.ArrayList list=new ArrayList();
10
Doc doc=new Doc(System.DateTime.Now);
11
doc.Title="计划";
12
doc.file=new File("福建");
13
list.Add(doc);
14![](/Images/OutliningIndicators/InBlock.gif)
15
Doc doc1=new Doc(new DateTime(2004,4,6));
16
doc1.Title="报告";
17
doc1.IsAuditing=true;
18
doc1.file=new File("北京");
19
list.Add(doc1);
20
return list;
21
22
}
![](/Images/OutliningIndicators/None.gif)
2
![](/Images/OutliningIndicators/ExpandedBlockStart.gif)
3
![](/Images/OutliningIndicators/InBlock.gif)
4
![](/Images/OutliningIndicators/InBlock.gif)
5
![](/Images/OutliningIndicators/ExpandedBlockEnd.gif)
6
![](/Images/OutliningIndicators/None.gif)
7
![](/Images/OutliningIndicators/None.gif)
8
![](/Images/OutliningIndicators/ExpandedBlockStart.gif)
9
![](/Images/OutliningIndicators/InBlock.gif)
10
![](/Images/OutliningIndicators/InBlock.gif)
11
![](/Images/OutliningIndicators/InBlock.gif)
12
![](/Images/OutliningIndicators/InBlock.gif)
13
![](/Images/OutliningIndicators/InBlock.gif)
14
![](/Images/OutliningIndicators/InBlock.gif)
15
![](/Images/OutliningIndicators/InBlock.gif)
16
![](/Images/OutliningIndicators/InBlock.gif)
17
![](/Images/OutliningIndicators/InBlock.gif)
18
![](/Images/OutliningIndicators/InBlock.gif)
19
![](/Images/OutliningIndicators/InBlock.gif)
20
![](/Images/OutliningIndicators/InBlock.gif)
21
![](/Images/OutliningIndicators/InBlock.gif)
22
![](/Images/OutliningIndicators/ExpandedBlockEnd.gif)
实体:
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/ExpandedBlockStart.gif)
![](/Images/OutliningIndicators/InBlock.gif)
![](/Images/OutliningIndicators/InBlock.gif)
![](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
![](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
![](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
![](/Images/OutliningIndicators/ExpandedSubBlockEnd.gif)
![](/Images/OutliningIndicators/InBlock.gif)
![](/Images/OutliningIndicators/InBlock.gif)
![](/Images/OutliningIndicators/InBlock.gif)
![](/Images/OutliningIndicators/InBlock.gif)
![](/Images/OutliningIndicators/InBlock.gif)
![](/Images/OutliningIndicators/InBlock.gif)
![](/Images/OutliningIndicators/InBlock.gif)
![](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
![](/Images/OutliningIndicators/ExpandedSubBlockEnd.gif)
![](/Images/OutliningIndicators/InBlock.gif)
![](/Images/OutliningIndicators/InBlock.gif)
![](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
![](/Images/OutliningIndicators/InBlock.gif)
![](/Images/OutliningIndicators/ExpandedSubBlockEnd.gif)
![](/Images/OutliningIndicators/ExpandedBlockEnd.gif)
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/ExpandedBlockStart.gif)
![](/Images/OutliningIndicators/InBlock.gif)
![](/Images/OutliningIndicators/InBlock.gif)
![](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
![](/Images/OutliningIndicators/InBlock.gif)
![](/Images/OutliningIndicators/InBlock.gif)
![](/Images/OutliningIndicators/ExpandedSubBlockEnd.gif)
![](/Images/OutliningIndicators/ExpandedBlockEnd.gif)