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''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)
{
String usrcode;
int row;
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)
{
this.gridDataBoundGrid1.CurrentCell.EndEdit();
this.CurrentCellEditingComplete(null, null);
}
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.
any explanation?
thanks.
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.
Using v1.6.1.8
ADAdministrator Syncfusion Team January 16, 2004 08:20 PM UTC
Try doing your code in CurrentCellValidating (or CurrentCellMoving). These occur earlier than moving process than CurrentCellEditingComplete.
CLColin LamarreJanuary 16, 2004 10:02 PM UTC
Hi,
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?
TIA!
ADAdministrator Syncfusion Team January 19, 2004 11:13 AM UTC
In CurrentCellValidating, you get the current value from the Renderer.
GridCurrentCell cc = this.grid.CurrentCell;
string newValue = cc.Renderer.ControlText;
CLColin LamarreJanuary 19, 2004 12:56 PM UTC
That worked! thanks alot! you can close the ticket i just opened...