Wednesday 12 February 2014

Label control inside a grid view based on inline Conditional statement in ASP.NET

In this article I will explain how to write in-line query in GridView design page in ASP.NET

First of all you need identify the Column data type. If the column data type is integer then you need to write below code  

<asp:TemplateField HeaderText="Bill Value" HeaderStyle-CssClass="CenterAlign" ItemStyle-HorizontalAlign="Right">
        <ItemTemplate>
               <asp:Label ID='lblBillValue' runat="Server" Text='<%# (Convert.ToInt32(Eval("Value")) > 0?Eval("Value", "{0:0.00}"):"")%>'></asp:Label>
        </ItemTemplate>

 </asp:TemplateField>


No comments:

Post a Comment