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

Events from a dynamically created combobox

Thread ID:





4209 May 2,2003 05:00 PM UTC May 4,2003 08:55 PM UTC WinForms 3
Tags: GridControl
Sachin Bammi
Asked On May 2, 2003 05:00 PM UTC

Hi, I am dynamically created adding a column in a databound grid and defining the cell type as follows: ********************************************* GridBoundColumn gbc = new GridBoundColumn(); GridDataBoundGridModel model = m_GridDataBoundGrid.DataBoundGridModel; gbc.MappingName = strField; gbc.HeaderText = strHeaderName; m_GridDataBoundGrid.GridBoundColumns.Add(gbc); GridStyleInfo colStyle = model.ColStyles[strField]; colStyle.CellType = "ComboBox"; ********************************************** Now my question is that, how do I catch events like "SelectedIndexChanged" or "SelectedTextChanged" from this combobox that I am dynamically adding. thanks for your help. -Sachin.

Administrator [Syncfusion]
Replied On May 2, 2003 07:09 PM UTC

You can use standard grid current cell events to catch actions on tne current cell. If you want to catch every change, then you handle CurrentCellChanged. If you want to only catch the action after the user indicates he is finished editing, you can catch CurrentCellValidating or CurrentCellConfirmChanges.

Sachin Bammi
Replied On May 4, 2003 07:35 PM UTC

Thanks for your reply. I am trying the following approach as per your advice. private void m_GridDataBoundGrid_CurrentCellChanged(object sender, System.EventArgs e) { int colindex = m_GridDataBoundGrid.CurrentCell.ColIndex; if(colindex != 2) //To check if it was the type //combobox (i.e. from column 2) return; //The combobox has a choiselist that consists of //the word "BIT". I want to catch the event when //user selects that from the list. So I am trying //the following: if((((Syncfusion.Windows.Forms.Grid.GridDataBoundGrid)sender).CurrentCell).ToString()== "BIT") //This does not work obviously. Is //there a way to know the text chosen //by the user here ? Is there a way to //handle the "SelectedTextChanged"? It //seems that if I use this method as you // had suggested then this event is not //exposed at all. { MessageBox.Show("Yes!"); } } regards, Sachin.

Administrator [Syncfusion]
Replied On May 4, 2003 08:55 PM UTC

You get the new text from the active cellrenderer.
private void grid_CurrentCellValidating(object sender, CancelEventArgs e)

	GridCurrentCell cc = this.grid.CurrentCell;

	if(cc.Index == 2)
		string newValue = cc.Renderer.ControlText;
		string oldValue = this.grid[cc.RowIndex, cc.ColIndex].Text;


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

Live Chat Icon For mobile
Live Chat Icon