Home > Archive > ASP .NET > November 2004 > Differences between 2 tags
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
Differences between 2 tags
|
|
| Ed Chiu 2004-11-30, 4:03 pm |
| Hi,
What are the differences between
<%# Container.DataItem("CustomerID") %>
and
<%# Databinder.eval(Container.DataItem, "CustomerID") %>
I saw both of them used in a lot of sample codes.
TIA
| |
| Scott Allen 2004-11-30, 4:03 pm |
| They would both achieve the same result, but -
The first expression will only work if the language setting of the
page is "VB".
The second expression with DataBinder.Eval will work in either a
language = "VB" or a language = "C#" page.
--
Scott
http://www.OdeToCode.com/blogs/scott/
On Tue, 30 Nov 2004 09:05:03 -0800, "Ed Chiu"
<EdChiu@discussions.microsoft.com> wrote:
>Hi,
>
>What are the differences between
>
><%# Container.DataItem("CustomerID") %>
>and
><%# Databinder.eval(Container.DataItem, "CustomerID") %>
>
>I saw both of them used in a lot of sample codes.
>
>TIA
| |
| bruce barker 2004-11-30, 4:03 pm |
| 1) the first is a direct method call returning the default data type. the
<%#%> operator is expecting a string return value. in the case of c#, a
compile/runtime error will return if the method does not return a string.
2) the eval method uses reflection, to execute the method. it always returns
a string.
"Ed Chiu" <EdChiu@discussions.microsoft.com> wrote in message
news:7D16755C-861F-4DF2-9442-A4BD474B120F@microsoft.com...
| Hi,
|
| What are the differences between
|
| <%# Container.DataItem("CustomerID") %>
| and
| <%# Databinder.eval(Container.DataItem, "CustomerID") %>
|
| I saw both of them used in a lot of sample codes.
|
| TIA
|
|
|
|
|