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. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Combo Click Event...

Thread ID:





45978 Jul 3,2006 02:55 PM UTC Jul 6,2006 07:32 PM UTC WinForms 5
Tags: GridControl
Sathish Chandran
Asked On July 3, 2006 02:55 PM UTC

Hi, For a cell, I''ve assigned a ComboBox to its celltype. I want to get its onclick event, but it should not be combo button custom control. Please advice me, how should I do it. Thanks & Regards, Sathish.

Administrator [Syncfusion]
Replied On July 3, 2006 04:51 PM UTC

Hi Sathish, For click on a textbox part of the combo box cell: You can use the GridComboBoxCellRenderer.TextBox''s click event to catch the single click on the text part of the comobox cell in a grid. Here is a code snippet. //Form Load GridComboBoxCellRenderer cr = this.gridControl1.CellRenderers["ComboBox"] as GridComboBoxCellRenderer; cr.TextBox.Click +=new EventHandler(TextBox_Click); private void TextBox_Click(object sender, EventArgs e) { Console.WriteLine("clicked"); } For click on the dropdown button of the combo box cell: To catch the single click event of the combo box cell dropdown button in a grid , you need to handle the grid''s CellButtonClicked .Here is a code snippet. //Form Load. this.gridControl1.CellButtonClicked += new Syncfusion.Windows.Forms.Grid.GridCellButtonClickedEventHandler(this.gridControl1_CellButtonClicked); private void gridControl1_CellButtonClicked(object sender, Syncfusion.Windows.Forms.Grid.GridCellButtonClickedEventArgs e) { if( e.Button is Syncfusion.Windows.Forms.Grid.GridCellComboBoxButton ) Console.WriteLine("Welcome" + e.Button ); } Let me know if this helps. Best Regards, Haneef

Clive Hill
Replied On July 6, 2006 12:08 PM UTC

Did this work? If I set up the following: GGC.TableControlCurrentCellShowingDropDown += new Syncfusion.Windows.Forms.Grid.Grouping.GridTableControlCurrentCellShowingDropDownEventHandler(GGC_TableControlCurrentCellShowingDropDown); and then have this: private void GGC_TableControlCurrentCellShowingDropDown(object sender, Syncfusion.Windows.Forms.Grid.Grouping.GridTableControlCurrentCellShowingDropDownEventArgs e) { //Use this method to popualte the drop down GridCurrentCell cc = e.TableControl.CurrentCell; GridComboBoxCellRenderer cr = cc.Renderer as GridComboBoxCellRenderer; if( cr != null) { cr.TextBox.Click +=new EventHandler(TextBox_Click); } } When I click on an item in the drop down TextBox_Click method is not trigerred.

Clive Hill
Replied On July 6, 2006 01:03 PM UTC

If I do: cr.ListBoxPart.Click +=new EventHandler(ListBoxPart_Click); Instead the event is captured. Unfortunately, there doesn''t seem to be a way to get reference to the cell this event originated from to update the displayed text.

Clive Hill
Replied On July 6, 2006 04:32 PM UTC

Actually, GGC.TableControl.Table.CurrentRecord.GetValue can be used. I now update the value from ListBoxPart_Click using the QueryCellStyleInfo. If I change the selected item in drop down the display text isn''t updated (it is set correctly using e.Style.Text though) until the user clicks on anything else other than that cell. Is there a way to get the text to refresh immediately?

Administrator [Syncfusion]
Replied On July 6, 2006 07:32 PM UTC

Hi Vito, Here is a code snippet which demonstrates a way to update the grid cell, when the user selected a value in the dropdown. Updating the selected value in the QueryCellStyleInfo event would cause a performance issue. I hope this code helps to solve your issue, kindly update us more details if your requirement is different. >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> private void gridGroupingControl1_TableControlCurrentCellCloseDropDown(object sender, GridTableControlPopupClosedEventArgs e) { GridCurrentCell cc = this.gridGroupingControl1.TableControl.CurrentCell; GridComboBoxCellRenderer cr = cc.Renderer as GridComboBoxCellRenderer; Record r = this.gridGroupingControl1.Table.CurrentRecord; if(r!=null) { object value = cr.ListBoxPart.SelectedValue; if(value != null) { r.SetValue("Col0",value); this.gridGroupingControl1.TableControl.RefreshRange(GridRangeInfo.Row(cc.RowIndex)); } } } >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> Best regards, Madhan


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.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon 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.Close Icon