I''m trying to set some cells with values once a selection is made from a drop down grid in the first colunm.
Here is a snip of the code:
private void CurrentCellEditingComplete(object o, EventArgs e)
if (this.gridDataBoundGrid1.CurrentCell.ColIndex == 3)
row = this.gridDataBoundGrid1.CurrentCell.RowIndex;
usrcode = ap(this.gridDataBoundGrid1.Model[row, 3].CellValue.ToString());
this.gridDataBoundGrid1.Model[row, 5].CellValue =
GTHub.utils.getsval("select max(description) from accodes where usrcode =" + usrcode).Trim();
this.gridDataBoundGrid1.Model[row, 4].CellValue =
GTHub.utils.getsval("select max(acctcode) from accodes where usrcode =" + usrcode);
this.gridDataBoundGrid1.Model[row, 2].CellValue = Convert.ToInt64(this.comboBoxExt1.Text);
this.gridDataBoundGrid1.Model.ColWidths.ResizeToFit(GridRangeInfo.Rows(0, 20), GridResizeToFitOptions.NoShrinkSize);
private void gridDataBoundGrid1_Leave(object sender, System.EventArgs e)
It''s weird, it puts the first value in the right place, but the next 2 are put in a new row with the rest of the cols null.
If i rearange them the same thing happens, the first is good, the next 2 aren''t. then saving with an sqladapter.update of course
messes up the table with these 2 rows.
Forgot to mention that this behavior only happens when a row other than the current row is used to click away from the drop down col. If i click on the same row it works fine.
ADAdministrator Syncfusion Team January 16, 2004 03:20 PM
Try doing your code in CurrentCellValidating (or CurrentCellMoving). These occur earlier than moving process than CurrentCellEditingComplete.
CLColin LamarreJanuary 16, 2004 05:02 PM
i tried a few other events like currentcellchanged etc, i just tried the validating one. the problem is that the cell value isn''t set to the new drop down choice yet. that''s why i went with CurrentCellEditingComplete.
how would you get the new value inside these other events?
ADAdministrator Syncfusion Team January 19, 2004 06:13 AM
In CurrentCellValidating, you get the current value from the Renderer.
GridCurrentCell cc = this.grid.CurrentCell;
string newValue = cc.Renderer.ControlText;
CLColin LamarreJanuary 19, 2004 07:56 AM
That worked! thanks alot! you can close the ticket i just opened...