Conditional (if statement) in a datagrid
- From: maflatoun@xxxxxxxxx
- Date: 2 Mar 2006 06:31:06 -0800
Hi,
I have a datagrid and based on a condition I like to display either a
asp:textbox or asp:label. How would I do that? I have the following
<asp:TemplateColumn HeaderText="Qty">
<ItemTemplate>
<% if (DataBinder.Eval(Container.DataItem, "DynamicAttribute") = "No")
{%>
<asp:textbox id="tbxQtyNew" BackColor='<%#
SetTextBoxColor(DataBinder.Eval(Container.DataItem,
"DynamicAttribute")) %>' runat="server" text='1' />
<% } else { %>
<asp:Label id="lblQtyDisp" Text="1" runat="server"/>
<% } %> </ItemTemplate>
</asp:TemplateColumn>
Which fails. Any idea?
Thanks
Maz.
.
- Follow-Ups:
- Re: Conditional (if statement) in a datagrid
- From: amiekweon
- Re: Conditional (if statement) in a datagrid
- Prev by Date: Re: PreRender event not firing on UserControl with 2.0 framework
- Next by Date: Re: Application Trace Profiler
- Previous by thread: Re: PreRender event not firing on UserControl with 2.0 framework
- Next by thread: Re: Conditional (if statement) in a datagrid
- Index(es):
Relevant Pages
|