Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Web Controls > In a template, Eval () does not works in fields ofcontrols, it works

Reply
Thread Tools

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

 
 
abargaddon
Guest
Posts: n/a
 
      01-27-2008
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
 
Reply With Quote
 
 
 
 
clintmazur
Guest
Posts: n/a
 
      02-04-2008
Does it work if your control is formatted like this:

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

"abargaddon" wrote:

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

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
to eval or not to eval? Marc Girod Perl Misc 2 04-19-2011 01:13 PM
eval('07') works, eval('08') fails, why? Alex van der Spek Python 6 01-08-2009 08:24 PM
Different behavior between eval "07" and eval "08" Liang Wang Perl Misc 8 02-02-2008 08:31 PM
DataBinder.Eval and Eval. craigkenisston@hotmail.com ASP .Net 1 06-16-2006 05:33 PM
DataBinder.Eval for an object's property property... like Eval(Container.DataItem,"Version.Major") Eric Newton ASP .Net 3 04-04-2005 10:11 PM



Advertisments