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.
Unfortunately, activation email could not send to your email. Please try again.

GridDataBoundGrid - catching events in user defined Cell Model

Thread ID:





50057 Oct 4,2006 11:44 AM Oct 6,2006 08:37 AM Windows Forms 3
Tags: GridControl
Clive Hill
Asked On October 4, 2006 11:44 AM


I have a UserControl which appears in a series of header cells. This UserControl consists of two CheckBox''s and two ComboBox''s. If I click on a CheckBox/ComboBox in the Cell, the whole cell is temporarily highlighted, and the appropriate event is not kicked off.

I looked at:

Syncfusion\Essential Studio\\Windows\Grid.Windows\Samples\In Depth\DerivedCellControlTutorial\CS

and a UserCotrnol sample I found on the Forum, but still can''t see how to do this.

I''ve attached the code that I use. Can someone point me in the right direction?



(In code that adds cell model I do:
_dataGrid.Model.CellModels.Add("OverrideSettings", new OverrideSettingsControlCell(_dataGrid.Model));

and the PrepareViewStyleInfo for the appropriate cells does:

e.Style.CellType = "OverrideSettings";


Administrator [Syncfusion]
Replied On October 5, 2006 01:48 AM

Hi Vito,

This is the default behavior of the Custom cell type, however to get the desired behavior, please raise the appropriate event using Raisexxxx method and find the below code for calling the CheckBoxClick event


Please refer the below forum thread for calling the SaveCellInfo event.

Let us know if you have any other questions.


Clive Hill
Replied On October 5, 2006 08:01 AM

Hi Haneef,

In my custom renderer object (OverrideSettingsControlCellRenderer) I override OnClick to trap when a user clicks on the cell.

If I then call:


The CheckboxClick is raised for the data grid. This doesn''t help me that much as I still don''t know which Control (CheckBox/ComboBox) within the UserControl was clicked on.

In OverrideSettingsControlCellRenderer I call a method I added called ControlClicked, which takes in the arguments and attempts to find which control was called by working out the X and Y positions (taking into account previous columns and rows above) then calling:

Control childControl = this._mainPanel.GetChildAtPoint(new Point(e.X, e.Y));

to get the Control. The next step I guess would be to attempt to raise the event. I can see how this might work for CheckBox''s but ComboBox''s could be a bit tricky (displaying contents etc).

Is this the path you''d recommend or is there a better way?




Administrator [Syncfusion]
Replied On October 6, 2006 08:37 AM

Hi Vito,

You can use the OverrideSettingsControlCellRenderer.ClikcontrolName property to find the name of the clicked control. Please refer to the attached sample for more details.

activeControl._chbxMarketOnOff.Click +=new EventHandler(controlClick);
activeControl._chbxAutoExec.Click +=new EventHandler(controlClick);

public string ClickcontrolName = string.Empty;

private void controlClick(object sender, EventArgs e)
Control c = sender as Control;
ClickcontrolName = c.Name;

if( c is CheckBox )
this.Grid.RaiseCheckBoxClick(this.RowIndex,this.ColIndex, new MouseEventArgs(MouseButtons.Right,1,Cursor.Position.X,Cursor.Position.Y,1 ) );
this.Grid.RaiseCellClick(this.RowIndex,this.ColIndex, new MouseEventArgs(MouseButtons.Right,1,Cursor.Position.X,Cursor.Position.Y,1 ) );

Sample : http://www.syncfusion.com/Support/user/uploads/UserCellGrid_798f9c08.zip

Let me know if this helps.

Best Regards,


This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.