AD
Administrator
Syncfusion Team
September 25, 2003 06:46 PM UTC
You will have to implement event handlers or overrides for OnDataProviderQueryCellInfo and OnDataProviderSaveCellInfo.
Suppose your dataSource has a TitleInfo object with a Title field and you only want to display the Title string in the column the you could do the following in OnDataProviderQueryCellInfo:
if (e.ColIndex == yourTitleColumnIndex && e.RowIndex > 0)
{
e.CellValue = record.TitleInfo.Tilte;
e.CellValueType = typeof(string);
e.Tag = record.TitleInfo;
e.Handled = true;
}
Setting e.Handled = true will prevent the standard handling of the grid of this column. And the grid will not retrieve the object from your underlying class.
Now, your custom renderer can be a TextBox-derived cell and allow editing of the string. And it also has access to the TitleInfo object through (TitleInfo) style.Tag (in case you need that).
In OnDataProviderSaveCellInfo you can then save back the modified title into the title object, e.g.:
if (e.ColIndex == yourTitleColumnIndex && e.RowIndex > 0)
{
(((TitleInfo) style.Tag).Title = e.Style.Text;
}
Stefan