G
Guest
Hi everyone,
Can someone show me how to display an empty string in a boundcolumn of a
datagrid when the data source item is NULL. Datagrid by default displays the
and that's BAD!!!!!
I've tried the following in the ItemDataBound event but it gave me an
"invalid cast" error:
DataRowView dataRowView = (DataRowView)e.Item.DataItem;
for (int i=0; i<e.Item.Cells.Count - 1; i++)
{
if (dataRowView.ToString().Trim() == System.DBNull.Value.ToString())
{
e.Item.Cells.Text = "";
}
}
PS. It's a web form, not a windows form, it if makes any difference.
Any suggestion is greatly appreciated.
KD
Can someone show me how to display an empty string in a boundcolumn of a
datagrid when the data source item is NULL. Datagrid by default displays the
and that's BAD!!!!!
I've tried the following in the ItemDataBound event but it gave me an
"invalid cast" error:
DataRowView dataRowView = (DataRowView)e.Item.DataItem;
for (int i=0; i<e.Item.Cells.Count - 1; i++)
{
if (dataRowView.ToString().Trim() == System.DBNull.Value.ToString())
{
e.Item.Cells.Text = "";
}
}
PS. It's a web form, not a windows form, it if makes any difference.
Any suggestion is greatly appreciated.
KD