Reputation: 69
I have this code :
<asp:TemplateField HeaderText="Active">
<ItemTemplate>
<%#Eval("IsActive")%>
</ItemTemplate>
</asp:TemplateField>
I have to use Eval to validate IsActive field, which is of type INTEGER. It can contain 1 or 0. By checking this value, I have to show to the user the output Yes or NO, because I don't want to show 1/0. Can you please tell me how to do it ?
Thanks in advance ;)
Upvotes: 1
Views: 2922
Reputation: 40
if value is integer the lblsuccess will be shown. And if value is not integer then lblerror is shown. Place this code inside item template
<asp:Label id="lblsuccess" runat="server" Text="value is integer"
Visible='<%# Int.TryParse("IntValue") ; %>' ></asp:Label>
<asp:Label id="lblerror" runat="server" Text="value is not integer"
Visible='<%# !Int.TryParse("IntValue") ; %>' ></asp:Label>
Upvotes: -1