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, if it makes any difference. Also,
the datagrid rows (items) are NOT EditItem type rows.
Any suggestion is greatly appreciated. I'm very desperate for an answer.
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, if it makes any difference. Also,
the datagrid rows (items) are NOT EditItem type rows.
Any suggestion is greatly appreciated. I'm very desperate for an answer.
KD