Repeater中的数据绑定。C#
来源:互联网 发布:u盘数据如何恢复 编辑:程序博客网 时间:2024/05/02 03:05
在aspx.cs中
页面aspx中
可以用
这两种绑定方式都可以。但是有点区别。
网站http://weblogs.asp.net/rajbk/archive/2004/07/20/what-s-the-deal-with-databinder-eval-and-container-dataitem.aspx中的解释比较详细。
来外的解释:
DataBinder.Eval uses reflection to get a value of a property of the
dataitem object. This is less performant than casting the dataitem
object to its actual type, and then access its property. The only
reason to use DataBinder.Eval is that the syntax may be/look simpler.
I always cast it to its actual type, which means it looks like this:
<%# ((MyObject)Container.DataItem).MyProperty %>
Or in case you are binding against a datatable, the dataitem is of the
the type datarowview:
<%# ((DataRowView)Container.DataItem)["MyField"] %>
The DataItem property returns a reference to an object, and
System.Object doesn't have an indexer defined. You'd have to cast the
DataItem return value to the proper type before the first expression
would compile.
DataBinder.Eval works because it will use reflection to dig out the
property with the name of "Author" dynamically. The second expression
would be the one to use in this case because it is the only one to
work.
- Repeater中的数据绑定。C#
- C#中的数据绑定
- repeater与数据绑定
- Repeater嵌套绑定数据
- repeater数据绑定
- repeater绑定数据
- Repeater嵌套绑定数据
- repeater控件绑定数据
- 嵌套repeater数据绑定
- Repeater动态绑定数据
- Repeater多层绑定数据
- Repeater 循环绑定数据
- repeater数据绑定
- DataTable绑定Repeater控件中的数据(vb.net)
- .net中的数据绑定,ObjectDataSource,Repeater,ItemTemplate,viewstate初步学习
- Repeater中的CheckBox绑定和存储数据之服务器控件
- Repeater中的CheckBox绑定和存储数据之Html控件
- sual C#中的数据绑定
- 硬盘(U盘、移动硬盘)MBR、DBR简介
- 九步迈向优秀软件设计——摘记
- PE启动过程简介
- 通往WinDbg的捷径(一)(二)
- Windows PE的作用
- Repeater中的数据绑定。C#
- C#递归实现Treeview
- grub4dos 多PE合盘制作过程及几个菜单命令简介
- 办个健身卡
- 任务
- 制作WinPE基本知识
- SQL存储过程分页算法研究(支持千万级)
- 如何建立404页面转向
- 制作WinPE启动光盘教程