什么是的DataBinder.Eval和的Container.DataItem之间的区别? [英] What's the difference between Databinder.Eval and Container.DataItem?

查看:275
本文介绍了什么是的DataBinder.Eval和的Container.DataItem之间的区别?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当你使用asp.net数据绑定前pressions:

 < ASP:标签文本='EX preSSION'=服务器/>

什么是之间的差异:

 的Container.DataItem(「该物业」)

 的DataBinder.Eval(的Container.DataItem,财产)

 评估(「该物业」)

 绑定(「该物业」)


解决方案

评估是单向绑定和绑定是双向绑定。使用评估让你获取内容到您的网页,但ASP.Net将不能够把它放回对象适合你。

评估方法只的DataBinder.Eval 的简写。此外,的Container.DataItem(「该物业」)当你想实际上是相同的,只是在评估方法返回路径的值。例如,您可以拨打评估用点分隔的路径,以你想要的值的公共属性,但我不相信你可以用<$做到这一点C $ C>的Container.DataItem(「该物业」)。

When you're using asp.net databinding expressions:

<asp:Label Text='EXPRESSION' runat="server" />

What's the difference among:

Container.DataItem("Property")

and

Databinder.Eval(Container.DataItem, "Property")

and

Eval("Property")

and

Bind("Property")

解决方案

Eval is one-way binding and Bind is for two way binding. Using Eval allows you to get the content into your page, but ASP.Net will not be able to put it back into an object for you.

The Eval method is just shorthand for DataBinder.Eval. Also, Container.DataItem("Property") is effectively the same as the Eval method except for when you want to return the value of a "path". For instance you can call Eval with a dot-separated "path" to a public property that you want the value of, but I do not believe you can do this with Container.DataItem("Property").

这篇关于什么是的DataBinder.Eval和的Container.DataItem之间的区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆