BCGControlBar Library for .NET
GetEditData Method (Cell)




Should return an object to be stored in item's data when the user has finished to edit cell.
Syntax
'Declaration
 
Public Overridable Function GetEditData() As Object
'Usage
 
Dim instance As Cell
Dim value As Object
 
value = instance.GetEditData()
public virtual object GetEditData()
public: virtual Object* GetEditData(); 
public:
virtual Object^ GetEditData(); 
Remarks

The GridControl calls this method when the user has finished to edit a cell and the modified data (or new data if the cell was empty) is about to be written back to GridDataItem.DataItem.

If your custom GridDataItem represents a complicated structure and only few fields of this structure has been updated, you have to just update these fields in the original ItemData object and set GridDataItem.Updated property to true. This will preserve the old (original) reference to data, but still cause the Grid to raise DataItemUpdated event.

For example, you have some complicated item data:

public class MyCustomItemData
{

public Text;
public Param1;
public Param2;

}

public override object GetEditData ()
{

if (DataItem == null || DataItem.ItemData == null)
{

return null;

}

// get the original data stored in the cell before edit

MyCustomItemData item = (MyCustomItemData) DataItem.ItemData;

// modify it with text taken from edit control
item.Text = m_editControl->Text;

// set update flag to make the caller understand that the item has been updated
item.Updated = true;

return item;

}

Requirements

Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

See Also

Reference

Cell Class
Cell Members

Send Feedback