View previous topic :: View next topic |
Author |
Message |
flc.net
Joined: 21 Jun 2005 Posts: 89 Location: Switzerland
|
Posted: Fri Sep 02, 2005 7:26 am Post subject: NullableDataLookupEditor |
|
|
Hello Support
I have written a DataLookupEditor that supports to reset a Value to null.
I use an GetCellData Event Listener to change the TypeEditor of the CellData from DataLookupEditor to NullableDataLookupEditor.
It's possible to implement this (or something like this) in an next Release of Virutal Tree?
Feel free to use the Code
Giuseppe
Code: |
public class NullableDataLookupEditor : ListUITypeEditor
{
DataColumn displayColumn;
public NullableDataLookupEditor(DataColumn displayColumn)
{
this.displayColumn = displayColumn;
}
protected override string GetDisplayString(object item)
{
if(item == DBNull.Value)
{
return "";
}
else
return displayColumn.Table.Rows.Find(item)[displayColumn].ToString();
}
protected override object GetValue(object item)
{
return item;
}
protected override IList GetItems(ITypeDescriptorContext context)
{
object[] primaryKeys = new object[displayColumn.Table.Rows.Count + 1];
primaryKeys[0] = DBNull.Value;
for(int i = 0;i < displayColumn.Table.Rows.Count; i++)
{
primaryKeys[i+1] = displayColumn.Table.Rows[i][displayColumn.Table.PrimaryKey[0]];
}
return primaryKeys;
}
}
|
|
|
Back to top |
|
|
Infralution
Joined: 28 Feb 2005 Posts: 5027
|
Posted: Fri Sep 02, 2005 8:57 am Post subject: |
|
|
Sure. We will look at this for the next release. _________________ Infralution Support |
|
Back to top |
|
|
Infralution
Joined: 28 Feb 2005 Posts: 5027
|
Posted: Fri Sep 30, 2005 10:30 am Post subject: |
|
|
In Version 2.1.0 the standard DataLookupEditor now takes a flag in the constructor indicating whether selection of a null value should be allowed. The DataRowCellBindings now set this flag if the DataColumn has AllowDBNull set to true. _________________ Infralution Support |
|
Back to top |
|
|
|