Home All Groups Group Topic Archive Search About

Using an IF statment within an ItemTemplate

Author
16 Mar 2005 7:42 PM
David Lozzi
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

Author
16 Mar 2005 8:34 PM
Elton Wang
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
elton_w***@hotmail.com

>-----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,
Show quoteHide quote
>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
>
>
>.
>