Infralution Support Forum Index Infralution Support
Support groups for Infralution products
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

NullableDataLookupEditor

 
Post new topic   Reply to topic    Infralution Support Forum Index -> Virtual Tree Feature Requests
View previous topic :: View next topic  
Author Message
flc.net



Joined: 21 Jun 2005
Posts: 89
Location: Switzerland

PostPosted: Fri Sep 02, 2005 7:26 am    Post subject: NullableDataLookupEditor Reply with quote

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
View user's profile Send private message
Infralution



Joined: 28 Feb 2005
Posts: 5027

PostPosted: Fri Sep 02, 2005 8:57 am    Post subject: Reply with quote

Sure. We will look at this for the next release.
_________________
Infralution Support
Back to top
View user's profile Send private message Visit poster's website
Infralution



Joined: 28 Feb 2005
Posts: 5027

PostPosted: Fri Sep 30, 2005 10:30 am    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    Infralution Support Forum Index -> Virtual Tree Feature Requests All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group