We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

CustomCellControl

Hello,

i'm using the GridGroupingControl.
i want to define a own control-type (per column).
The grid shall use this control to edit a cell for this column.
The control shall be instantiated when the user clicks the cell.
How can i achive such a behaviour?

There is a property
GridGroupingControl.TableControl.Model.Item(0,0).Control
but it remains on a nothing value when i try to set it.

When i try to set the backcolor of the GridTableCellSTyleInfo it won't work. Is it true that these Style infos are overwritten
by the values set in GridGroupingControl.Appearance?

Regards,
Karle

3 Replies

JJ Jisha Joy Syncfusion Team July 27, 2009 08:34 AM UTC

Hi Karle,

Thank you for using Syncfusion products.

A custom CellType can be created in a GridGroupingControl. Custom celltype requires a 'model' class and a 'renderer' class. The model class handles the serialization requirements for the control and creates the renderer class. The renderer class handles the UI requirements of the cell, such as drawing it, handling mouse actions etc.

Here is the minimal sample which shows you how to create a custom celltype(which include the custom control "MyControl").
Sample

In GridGroupingControl we need to handle either QueryCellStyleInfo event or TableControlPrepareViewStyleInfo event to apply cell specific styles. See the code: You could check for the col/row index and set the styles.

this.gridGroupingControl1.QueryCellStyleInfo += new GridTableCellStyleInfoEventHandler(gridGroupingControl1_QueryCellStyleInfo);


void gridGroupingControl1_QueryCellStyleInfo(object sender, GridTableCellStyleInfoEventArgs e)
{
if (e.TableCellIdentity.ColIndex == 2 && e.TableCellIdentity.RowIndex == 5)
e.Style.BackColor = Color.SteelBlue;
}


Please let me know if you have any questions.

Regards,
Jisha


VG Varun Gupta March 19, 2010 07:23 AM UTC

Hi Jisha,

I believe that it is possible to change the color of a regular cell also based on some conditions at runtime.

I am using a validation function which is called once the user has entered the data. If the validation fails on any data field, i need to update that cell red and display an error text next to it.

I am using the gridgroupingcontrol.tablemodel[row,col].Backcolor = Color.Red

But nothing is happening sadly.

Please advice

Thanks and Regards,
Varun


RC Rajadurai C Syncfusion Team March 25, 2010 06:10 AM UTC

Hi Varun,

Thanks for your interest in Syncfusion Products.

It seems you have posted similar inquiry as an incident(#65945) in Direct Trac which is being followed up. Please followup with that for any further queries regarding this.

Regards,
Rajadurai

Loader.
Live Chat Icon For mobile
Up arrow icon