什么是的DataBinder.Eval和的Container.DataItem之间的区别? [英] What's the difference between Databinder.Eval and 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屋!