Thank you for your reply,
However I am experiencing something strange:
The following is working fine:
<asp:TextBox Text=<%# "foo" + DataBinder.Eval
(Container.Data Item, "bar").ToString () %> runat="server"/>
but if I want to use this way to set the ID attribute it
does not seem possible, so I am not sure what to do, maybe
I should check out the CommandText property???
<asp:TextBox ID=<%# "foo" + DataBinder.Eval
(Container.Data Item, "bar").ToString () %> runat="server"/>
Parser Error Message: '<%# "foo" + DataBinder.Eval (Container.Data Item,
"bar").ToString () %>' is not a valid identifier.
Why this error? Why can't I just set the value of the
ID property in this way like I can set everything else???
Thanks,
Neil
Anders Norås wrote:
Neil Zanella wrote: I would like to know what the difference is among the constructs
<%= %> for evaluating an expression and displaying the evaluated
result on the page and <%# %>.
<%# %> is the ASP.NET data-binding expression. You can include
data-binding expressions on the value side of an attribute/value pair
in the opening tag of a server control or anywhere else in a page.
<%= %> is shorthand for Response.Write.
The Response.Write expressions are evaluated when the page is
processed. The data-binding expressions create bindings between any data source,
property, collection, expression or result returned from a method
call when the page's DataBind method is called.
Anders Norås
http://dotnetjunkies.com/weblog/anoras/