I am using gridview to fetch the data from sqlserver. there are few values which are NULL. How to show these values using Gridview?
2 Answers
May be this will help you,
<asp:GridView ID="id" runat="server" CellPadding="4">
<Columns>
<asp:TemplateField>
<ItemTemplate>
<%# Convert.ToString(Eval("columnName")) == null ? 'any text you want to write' : Eval("columnName") %>
</ItemTemplate>
</asp:TemplateField>
</asp:GridView>
1 Comment
Sateesh Pagolu
you are converting it to string and comparing with keyword Null. dont you see an issue?
SELECT ISNULL(ColumnName, 'no value')