Unplanned
Last Updated: 15 Aug 2017 09:33 by Svetlin
Svetlin
Created on: 16 Mar 2012 05:20
Category: GridView
Type: Feature Request
1
ADD. RadGridView - allow the user to easily change the behavior depending on whether the cell's value is empty string or null
Make possible users easily to change the behavior of replacing the null value with empty string.

Workaround: 
DataTable table = new DataTable("table");
table.Columns.Add("ID", typeof(int));
DataColumn col = table.Columns.Add("Name", typeof(string));
col.AllowDBNull = false;
col.DefaultValue = string.Empty;
table.ColumnChanging += new DataColumnChangeEventHandler(table_ColumnChanging);
this.radGridView1.DataSource = table;

private void table_ColumnChanging(object sender, DataColumnChangeEventArgs e)
{
    if (!e.Column.AllowDBNull && (e.ProposedValue == DBNull.Value || e.ProposedValue == null) && e.Column.DataType == typeof(string))
    {
        e.ProposedValue = string.Empty;
    }
}
0 comments