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.

OnValidating event in a combobox added to a GDBG cell

Thread ID:

Created:

Updated:

Platform:

Replies:

44295 May 19,2006 06:52 AM May 22,2006 03:42 AM Windows Forms 2
loading
Tags: GridControl
Borja
Asked On May 19, 2006 06:52 AM

Hi, I have a GridDataBoundGrid and i want to use a particular Combobox (inherited from System.Windows.Forms.ComboBox) to edit the value of one of the comlumns. Since i want the combobox (which is binded to a field of the GDBG datasource) only to be shown when the row is being edited i use this code in Model_QueryCellInfo event: if (e.RowIndex == iRowBeingEdited && e.ColIndex == 1){ e.Style.CellType = "Control"; e.Style.Control = cboSubcuentas; cboSubcuentas.Visible = true; } else e.Style.Control = null; My problem is that i have overriden combo''s OnValidating event, but when i leave the cell this event doesn''t get triggered. Am i doing anything wrong? I use VS2005 and version 4.1.0.50. Thanks in advance.

Administrator [Syncfusion]
Replied On May 19, 2006 08:55 AM

Hi Borja, You need to handle grid''s CurrentCellValidating event for validating the Control cell type. But it does n''t fire internally. You need to handle CurrentCell.IsModified flag properly. Without setting the CurrentCell.IsModified = true, your saveCellInfo is not called when you leave the cell the control which means your changes were not being saved in the grid. SaveCellInfo event fires the CurrentCellValidating Event. Please try this code in CurrentcellMoving Event. private void gridDataBoundGrid1_CurrentCellMoving(object sender, Syncfusion.Windows.Forms.Grid.GridCurrentCellMovingEventArgs e) { GridCurrentCell cc =this.gridDataBoundGrid1.CurrentCell; if(cc.RowIndex == 1 && cc.ColIndex == 1) { cc.IsModified = true; } } private void gridDataBoundGrid1_CurrentCellValidating(object sender, System.ComponentModel.CancelEventArgs e) { //Validate the comboBox here. MessageBox.Show(e.ToString()); } Here is a sample. http://www.syncfusion.com/Support/user/uploads/dataBoundCombo_a138d1cf.zip Let me know if you have any more questions. Regards, Haneef

Borja
Replied On May 22, 2006 03:42 AM

Thank you Haneef, it''s a little bit tricky, but it worked. I''ve seen the attribute IsModified in other posts, but i haven''t realized its right use. I have a few more questions, but, probably, it would be better to create new posts (since are not related to this one). Thank you again.

CONFIRMATION

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.

;