Eval 和 Bind 方法的区别

(转自http://www.cnblogs.com/JustDI/archive/2007/07/25/830217.html)

When binding an editable value to a control, you must use the Bind() method in your
data binding expression instead of the ordinary Eval() method. Only the Bind() method creates the two way link, ensuring that updated values will be sent back to the server.

Bind方法(双向数据绑定)即能把数据绑定到控件,又能把数据变更提交到数据库。
Eval方法(单向数据绑定)它实现了数据读取的自动化,但是没有实现数据写入自动化。
只要可以使用Eval的地方,就可以使用新的Bind方法。
<asp:TestBox Runat="server" ID ="TheNote" Text='<%# Bind("note") %>'
posted @ 2007-08-13 17:24  Gavin Liu  阅读(392)  评论(0编辑  收藏  举报

Right people get the right information at the right time.
以技术求生存,以市场求发展;学以至用,开拓创新;达技术之颠峰,至市场之广阔!