In a template, Eval () does not works in fields ofcontrols, it works

A

abargaddon

Hi all,

I am developing a hierarchical, templated control in order to show
hierarchical data in a more flexible way than with TreeView.
Databinding and retrieving works well in plmain text inside the
templates. However, it does not work in fields.

Example :

<gug:RecursiveULMenu ...>
<ItemTemplate>
Name=<%# Eval("Name") %>, Text=<%# Eval("Text") %>
<asp:HyperLink ID="HyperLink1" runat="server"
Text='link <%# Eval("Name") %>' />
<asp:Label ID="Label1" runat="server"
Text='label <%# Eval("Name") %>' />
<%#Eval("Name")%>
</ItemTemplate>
</gug:RecursiveULMenu>
Outcome :
The 2 first Eval() work. The 2 in HyperLink and Label don't work. The
last one works.

Can any one tell me what in my control does make that strange behavior ?

Regards,
Abargaddon
 
C

clintmazur

Does it work if your control is formatted like this:

<asp:Label ID="Label1" runat="server"
Text='<%# "label" + Eval("Name") %>' />
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Members online

Forum statistics

Threads
473,780
Messages
2,569,611
Members
45,263
Latest member
SimonZfx79

Latest Threads

Top