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

Discussion in 'ASP .Net Web Controls' started by abargaddon, Jan 27, 2008.

  1. abargaddon

    abargaddon Guest

    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
     
    abargaddon, Jan 27, 2008
    #1
    1. Advertising

  2. abargaddon

    clintmazur Guest

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

    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
    >
     
    clintmazur, Feb 4, 2008
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Eric Newton
    Replies:
    3
    Views:
    9,422
    Brock Allen
    Apr 4, 2005
  2. DataBinder.Eval and Eval.

    , Jun 16, 2006, in forum: ASP .Net
    Replies:
    1
    Views:
    551
    Karl Seguin [MVP]
    Jun 16, 2006
  3. Alex van der Spek

    eval('07') works, eval('08') fails, why?

    Alex van der Spek, Jan 8, 2009, in forum: Python
    Replies:
    6
    Views:
    1,463
    Bruno Desthuilliers
    Jan 8, 2009
  4. Phi!
    Replies:
    1
    Views:
    183
  5. Marc Girod

    to eval or not to eval?

    Marc Girod, Apr 19, 2011, in forum: Perl Misc
    Replies:
    2
    Views:
    161
    Marc Girod
    Apr 19, 2011
Loading...

Share This Page