Can you evaluate a databinding expression?

Discussion in 'ASP .Net' started by sydney.luu@gmail.com, Mar 28, 2006.

  1. Guest

    Hello,

    See part of the code shown below. I would like to know, without
    hooking to an event
    called ContentRepeater_ItemDataBound, is it possible to evaluate this
    databinding expression
    and based on the condition, create a LinkButton immediately follows
    this data and before
    this <TD> ends? Basically, how I can code it to say:

    If DataBinder.Eval(Container.DataItem, "CreateLinkButton") = "Y" Then
    <ASP:LinkButton ....................>
    End If

    Thanks for the help!
    Sydney






    <asp:Repeater id="ContentRepeater" runat="server"
    EnableViewState="False"
    OnItemDataBound="ContentRepeater_ItemDataBound">

    <ItemTemplate>
    <tr id="TableRow" runat="server" bgcolor="#FFFFFF">
    <td> <%# DataBinder.Eval(Container.DataItem,
    "CreateLinkButton") %></td>
     
    , Mar 28, 2006
    #1
    1. Advertising

  2. It's pretty safe to ignore my comment. Without knowing more about your
    system, I can only guess. It just _seems_ like presentation rules (ie, show
    this button or not) are being decided by something other than the
    presentation layer. But that could be a totally inaccurate view.

    Karl

    --
    http://www.openmymind.net/
    http://www.fuelindustries.com/


    <> wrote in message
    news:...
    > Karl,
    >
    > This will work for me and thanks for your help.
    >
    > I am not sure if I understand your "side note". Please explain.
    >
    > -Sydney
    >
    >
    > Karl Seguin [MVP] wrote:
    >> Yes.
    >>
    >> There's no good reason NOT to hook into an event, but yes it's possible.
    >> There are different ways, but:
    >>
    >> <asp:linkbutton id="whatever" runat="server" visible='<%#
    >> DataBinder.Eval(Container.DataItem, "CreateLinkButton") = "Y" %>' />
    >>
    >> on a side note, if your data layer is concernnig itself with a column
    >> named
    >> "CreateLinkButton", I'd suggest your layers are bleeding into each other.
    >>
    >> Karl
    >>
    >> --
    >> http://www.openmymind.net/
    >> http://www.fuelindustries.com/
    >>
    >>
    >> <> wrote in message
    >> news:...
    >> > Hello,
    >> >
    >> > See part of the code shown below. I would like to know, without
    >> > hooking to an event
    >> > called ContentRepeater_ItemDataBound, is it possible to evaluate this
    >> > databinding expression
    >> > and based on the condition, create a LinkButton immediately follows
    >> > this data and before
    >> > this <TD> ends? Basically, how I can code it to say:
    >> >
    >> > If DataBinder.Eval(Container.DataItem, "CreateLinkButton") = "Y" Then
    >> > <ASP:LinkButton ....................>
    >> > End If
    >> >
    >> > Thanks for the help!
    >> > Sydney
    >> >
    >> >
    >> >
    >> >
    >> >
    >> >
    >> > <asp:Repeater id="ContentRepeater" runat="server"
    >> > EnableViewState="False"
    >> > OnItemDataBound="ContentRepeater_ItemDataBound">
    >> >
    >> > <ItemTemplate>
    >> > <tr id="TableRow" runat="server" bgcolor="#FFFFFF">
    >> > <td> <%# DataBinder.Eval(Container.DataItem,
    >> > "CreateLinkButton") %></td>
    >> >

    >
     
    Karl Seguin [MVP], Mar 28, 2006
    #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. EDom

    How to evaluate an expression

    EDom, Jul 18, 2005, in forum: ASP .Net
    Replies:
    2
    Views:
    457
    Charlie@NISH
    Aug 12, 2005
  2. Replies:
    28
    Views:
    11,983
    Fathzer
    Aug 29, 2012
  3. evan
    Replies:
    1
    Views:
    1,105
    John Harrison
    Jun 28, 2003
  4. Jason luo
    Replies:
    3
    Views:
    544
    Peter Ammon
    Aug 19, 2004
  5. Ramon F Herrera
    Replies:
    1
    Views:
    429
    Joe Attardi
    Dec 13, 2007
Loading...

Share This Page