• 博客园logo
  • 会员
  • 众包
  • 新闻
  • 博问
  • 闪存
  • 赞助商
  • HarmonyOS
  • Chat2DB
    • 搜索
      所有博客
    • 搜索
      当前博客
  • 写随笔 我的博客 短消息 简洁模式
    用户头像
    我的博客 我的园子 账号设置 会员中心 简洁模式 ... 退出登录
    注册 登录
Just do it!
去想,去做,去努力,去奋斗,自己的未来是由自己改变的.
博客园    首页    新随笔    联系   管理    订阅  订阅
Eval 和 Bind 方法的区别
转自:http://hi.baidu.com/hailibu/blog/item/443186774d2b8b19b051b99c.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 on 2007-07-25 08:42  JustDI  阅读(761)  评论(4)    收藏  举报
刷新页面返回顶部
博客园  ©  2004-2025
浙公网安备 33010602011771号 浙ICP备2021040463号-3