Reputation: 62
I am using gridview to fetch the data from sqlserver. there are few values which are NULL. How to show these values using Gridview?
Upvotes: 0
Views: 2902
Reputation: 588
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>
Upvotes: 0
Reputation: 9606
As per your feedback in comments, use this..
SELECT ISNULL(ColumnName, 'NULL')
Upvotes: 2