Using an IF statment within an ItemTemplate

D

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!
 
E

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
(e-mail address removed)
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,053
Latest member
BrodieSola

Latest Threads

Top