Differences between 2 tags

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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
 
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.
 
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.

| 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
 
Back
Top