if statement inside Repeater ItemTemplate

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • =?Utf-8?B?T2xlZw==?=

    if statement inside Repeater ItemTemplate

    using .net 2.0
    Trying to put condition on current value in repeater in this manner:
    <% if(<%# DataBinder.Eval (Container.Data Item, "FROM_NET") != "Hourly
    Rate")%%>
    <asp:TextBox Value='<%# DataBinder.Eval (Container.Data Item, "DELIVERY")
    %>' runat="server"/>
    <% else %>
    <asp:Label Text='<%# DataBinder.Eval (Container.Data Item, "DELIVERY") %>'
    runat="server"/>

    Of course that doesn't work.
    Please, need some help may be with syntax or work around for this problem.
    Thanks,
    Oleg
  • Cowboy \(Gregory A. Beamer\)

    #2
    Re: if statement inside Repeater ItemTemplate

    When you need complex logic on each row bound to a control, use the Data
    Binding event for that control. It allows you to do tests and intercept as
    needed. Example here:


    --
    Gregory A. Beamer
    MVP, MCP: +I, SE, SD, DBA

    *************** *************** *************** ****
    | Think outside the box!
    |
    *************** *************** *************** ****
    "Oleg" <Oleg@discussio ns.microsoft.co mwrote in message
    news:1FECA814-02DB-490E-90B5-8C52F50E8A6B@mi crosoft.com...
    using .net 2.0
    Trying to put condition on current value in repeater in this manner:
    <% if(<%# DataBinder.Eval (Container.Data Item, "FROM_NET") != "Hourly
    Rate")%%>
    <asp:TextBox Value='<%# DataBinder.Eval (Container.Data Item, "DELIVERY")
    %>' runat="server"/>
    <% else %>
    <asp:Label Text='<%# DataBinder.Eval (Container.Data Item, "DELIVERY") %>'
    runat="server"/>
    >
    Of course that doesn't work.
    Please, need some help may be with syntax or work around for this problem.
    Thanks,
    Oleg

    Comment

    Working...