ASP .NET - 这是怎么回事背后的eval()?这是怎么回事、ASP、NET、eval

2023-09-03 02:57:49 作者:不可测的感情

我想了解的eval()如何为特定的目的。我工作的一个项目,我真的不知道,我需要阅读一些数据,并把它们在下拉列表中。这些数据已经被读出并显示内部一个ItemTemplate。我注意到有使用eval()方法读取。 是这样的:

I'm trying to understand how Eval() works for a specific purpose. I'm working on a project I don't really know and I need to read some data and put them in drop down list. These data are already read and are displayed inside an ItemTemplate. I noticed there are read using the Eval() method. Something like:

<ItemTemplate>
   <a href="...=<%# Eval("foo") %>></a>
</ItemTemplate>

我需要知道评估和演示是从为了获得这些数据,以发现我应该在哪里阅读我的下拉列表中!但我真的不明白它是如何工作! 我知道的eval()计算数据绑定EX pressions在运行,但在这里你认为我应该看看?

I need to know where Eval is getting these data from in order to discover where I should read them for my drop down list! But I didn't really understand how it works! I know that Eval() evaluates data binding expressions at runtime but where do you think I should take a look at?

感谢您

推荐答案

这是一个很好的资源:的 http://bytes.com/topic/asp-net/answers/447041-databinder-eval-mystification

This is a good resource: http://bytes.com/topic/asp-net/answers/447041-databinder-eval-mystification

一些原因,以避免它:的http://博客.asp.net / jgalloway /存档/ 2005/09/20 / 425687.aspx

Some reasons why to avoid it: http://weblogs.asp.net/jgalloway/archive/2005/09/20/425687.aspx

通过显式类型转换,以提高一个办法:的http://dotnettipoftheday.org/tips/use-explicit-casting-instead-of-databinder.eval.aspx

One way to improve by explicit cast: http://dotnettipoftheday.org/tips/use-explicit-casting-instead-of-databinder.eval.aspx

HTH。