Using an IF statment within an ItemTemplate

Discussion in 'ASP .Net Datagrid Control' started by David Lozzi, Mar 16, 2005.

  1. David Lozzi

    David Lozzi Guest

    Hello,

    I have a datagrid listing bill to addresses. One column specifies whether or
    not the bill to is the primary for the customer. Here's my dilemma: I would
    like to add the option to set another bill to to primary within the data
    grid. So something like this

    <% if container.dataitem("bitPrimary") = 1 then %>
    Primary
    <% else %>
    <asp:LinkButton Runat="server"
    commandname="setPrimary(<%#container.dataitem("ID")%>)">Make
    Primary</asp:LinkButton>
    <% end if %>

    So, if the item is already primary, it will simply state that. If it is not,
    then give the user the option to set it. I can hanld ethe function
    setPrimary(), but this IF statement doesn't work within the datagrid.

    Thanks!


    --
    David Lozzi
    Web Applications Developer
    dlozzi@(remove-this)delphi-ts.com
     
    David Lozzi, Mar 16, 2005
    #1
    1. Advertising

  2. David Lozzi

    Elton Wang Guest

    Hi David,

    Instead in HTML section, you can process your logic in
    ItemDataBound event. It's easy for you to code any logic.

    HTH

    Elton Wang


    >-----Original Message-----
    >Hello,
    >
    >I have a datagrid listing bill to addresses. One column

    specifies whether or
    >not the bill to is the primary for the customer. Here's

    my dilemma: I would
    >like to add the option to set another bill to to primary

    within the data
    >grid. So something like this
    >
    ><% if container.dataitem("bitPrimary") = 1 then %>
    > Primary
    ><% else %>
    > <asp:LinkButton Runat="server"
    >commandname="setPrimary(<%#container.dataitem("ID")%
    >)">Make
    >Primary</asp:LinkButton>
    ><% end if %>
    >
    >So, if the item is already primary, it will simply state

    that. If it is not,
    >then give the user the option to set it. I can hanld ethe

    function
    >setPrimary(), but this IF statement doesn't work within

    the datagrid.
    >
    >Thanks!
    >
    >
    >--
    >David Lozzi
    >Web Applications Developer
    >dlozzi@(remove-this)delphi-ts.com
    >
    >
    >.
    >
     
    Elton Wang, Mar 16, 2005
    #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. JL

    Return statment

    JL, Dec 17, 2003, in forum: ASP .Net
    Replies:
    2
    Views:
    393
    Hermit Dave
    Dec 17, 2003
  2. crjunk
    Replies:
    2
    Views:
    1,587
    crjunk
    Sep 3, 2004
  3. Bennett Haselton
    Replies:
    1
    Views:
    5,341
    Joe Fallon
    Sep 24, 2004
  4. Luk
    Replies:
    2
    Views:
    310
    Andrew Thompson
    Feb 10, 2004
  5. Bill Sneddon
    Replies:
    2
    Views:
    1,198
    Bill Sneddon
    Jun 28, 2003
Loading...

Share This Page