<%# DataBinder.Eval(Container.DataItem, "FirstName") %> in a fieldof a web server co

<%# DataBinder.Eval(Container.DataItem, "FirstName") %> in a fieldof a web server co

am 28.01.2008 22:03:51 von abargaddon

Hello everybody,
I need to use bound variables in a field of a web server control which
is inside a template. Many sources in the Web say it works, but for me
it does not, so I have made a test page :

<%@ Page Language="C#" %>
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">




Ptitle




Test Repeater and templates




ItemTemplate : <%# DataBinder.Eval(Container.DataItem,
"OwnerId") %>
- <%# DataBinder.Eval(Container.DataItem, "FirstName") %>
Text='eval (<%# DataBinder.Eval(Container.DataItem,
"OwnerId") %>)' />
Text='eval (<%# DataBinder.Eval(Container.DataItem,
"FirstName") %>)' />









The result I obtain is below : Eval() does not work inside the asp:label
or the asp:hyperlink Text fields :

Test Repeater and templates
ItemTemplate : 111 - Alberto eval () eval ()
ItemTemplate : 111 - Alberto eval () eval ()

Can anyone help me please ?

Sincerely,
Abargaddon

RE: <%# DataBinder.Eval(Container.DataItem, "FirstName") %> in a field

am 29.01.2008 01:01:01 von mily242

Howdy,

In AP.NET 2.0 you can use Eval instead of DataBinder.Eval. In addition
remember data bound expressions for server controls must be defined in entire
attribute:

NOT


Anyway:


Ptitle




Test Repeater and templates




ItemTemplate : <%# DataBinder.Eval(Container.DataItem,
"OwnerId") %>
- <%# DataBinder.Eval(Container.DataItem, "FirstName") %>










Hope it helps
--
Milosz


"abargaddon" wrote:

> Hello everybody,
> I need to use bound variables in a field of a web server control which
> is inside a template. Many sources in the Web say it works, but for me
> it does not, so I have made a test page :
>
> <%@ Page Language="C#" %>
> > "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
>
>
>
>
> Ptitle
>
>
>

>


> Test Repeater and templates


>
>
> ItemTemplate : <%# DataBinder.Eval(Container.DataItem,
> "OwnerId") %>
> - <%# DataBinder.Eval(Container.DataItem, "FirstName") %>
> > Text='eval (<%# DataBinder.Eval(Container.DataItem,
> "OwnerId") %>)' />
> > Text='eval (<%# DataBinder.Eval(Container.DataItem,
> "FirstName") %>)' />
>

>

>

>

>
>
>
>
> The result I obtain is below : Eval() does not work inside the asp:label
> or the asp:hyperlink Text fields :
>
> Test Repeater and templates
> ItemTemplate : 111 - Alberto eval () eval ()
> ItemTemplate : 111 - Alberto eval () eval ()
>
> Can anyone help me please ?
>
> Sincerely,
> Abargaddon
>