Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save lamngockhuong/4a4e978d7339f9135c26 to your computer and use it in GitHub Desktop.
Save lamngockhuong/4a4e978d7339f9135c26 to your computer and use it in GitHub Desktop.
[Using IF ELSE Condition with EVAL function in ASP.Net GridView C#] #csharp
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="false">
<Columns>
<asp:BoundField DataField="Id" HeaderText="Id" ItemStyle-Width="50" />
<asp:BoundField DataField="Name" HeaderText="Name" ItemStyle-Width="150" />
<asp:TemplateField HeaderText="Status" ItemStyle-Width="100">
<ItemTemplate>
<asp:Label Text='<%# Eval("Status").ToString() == "A" ? "Absent" : "Present" %>'
runat="server" />
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
-------------------------------
Lam Ngoc Khuong
http://ngockhuong.com
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment