The Syncfusion native Blazor components library offers 70+ UI and Data Viz web controls that are responsive and lightweight for building modern web apps.
.NET PDF framework is a high-performance and comprehensive library used to create, read, merge, split, secure, edit, view, and review PDF files in C#/VB.NET.
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.
ADAdministrator Syncfusion Team May 19, 2006 12:55 PM UTC
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
BOBorjaMay 22, 2006 07:42 AM UTC
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.