Hi all I am having an integer value null in my table, I would like to bind it to gridview label with 0 when the value is null, for a nullable string I write this which works fine but the same with changes didn’t work can some one help
<asp:Label ID="lbl" runat="server" Text='<%#(String.IsNullOrEmpty(Eval("call").ToString()) ? "NULL" : Eval("call"))%>'></asp:Label>
The same for Integer I write as follows
<%# string.IsNullOrEmpty(Eval("send2").ToString()) ? "0" : Convert.ToInt16(Eval("send2")).ToString() %>
This didn’t worked, any help appreciated
To check for the null variables you usually use the
System.DBNull, so you code can be:or aleternative: