GBDG.Model[r, c].CellValue = x problem

Hi, decimal v = 5.5; this.gridDataBoundGrid1.Model[2, 9].CellValue = v; will set Model[1, 9] to the value also. whats going on?? dont think this happened in 2.1.0.9 now using 3.2.1.0, occured in 3.2 also thanks in advance

9 Replies

AD Administrator Syncfusion Team May 1, 2005 04:28 PM UTC

Using 3.2.1, I tried this code and it displayed what I would expect to see with first line in the output window showing 123.123 and the second line showing the entry above it.
private void button1_Click(object sender, System.EventArgs e)
{

	this.gridDataBoundGrid1[2,3].CellValue = 123.123;
	Console.WriteLine(this.gridDataBoundGrid1[2,3].CellValue);
	Console.WriteLine(this.gridDataBoundGrid1[1,3].CellValue);
}
Are you using an hierarchical GridDataBoundGrid? If so, there are extra header rows for each levels that you would have to take into account. Can you upload a little sample showing the problem you are having, or tell us how to see the problem in one of our samples?


AD Administrator Syncfusion Team May 1, 2005 05:10 PM UTC

could you try putting it in a CurrentCellMoving event, see if that reproduces it.


AD Administrator Syncfusion Team May 1, 2005 06:58 PM UTC

Try setting DirectSaveCellInfo around setting the value to see if that takes care of this problem. this.gridDataBoundGrid1.Binder.DirectSaveCellInfo = true; this.gridDataBoundGrid1[2,3].CellValue = 123.123; this.gridDataBoundGrid1.Binder.DirectSaveCellInfo = false;


AD Administrator Syncfusion Team May 1, 2005 09:44 PM UTC

yep that fixed it. thanks


AD Administrator Syncfusion Team May 1, 2005 10:04 PM UTC

woops this caused another problem... i type a value in say 2,3 which now sets 2,9 properly but 2,3 gets reset to the old value after the recalc. its a currency cell set to % if that makes a difference. gbcc["Percentage"].StyleInfo.CellType = "Currency"; gbcc["Percentage"].StyleInfo.CellValueType = typeof(string); gbcc["Percentage"].StyleInfo.Format = "C"; gbcc["Percentage"].StyleInfo.CurrencyEdit.NullString = "0.00 %"; gbcc["Percentage"].StyleInfo.CurrencyEdit.CurrencyNegativePattern = 5; gbcc["Percentage"].StyleInfo.CurrencyEdit.CurrencyPositivePattern = 3; gbcc["Percentage"].StyleInfo.CurrencyEdit.CurrencySymbol = "%"; gbcc["Percentage"].StyleInfo.CurrencyEdit.ClipMode = Syncfusion.Windows.Forms.Tools.CurrencyClipModes.ExcludeFormatting;


AD Administrator Syncfusion Team May 1, 2005 10:58 PM UTC

Try moving your code from CurrentCellMoving to CurrentCellMoved.
private void gridDataBoundGrid1_CurrentCellMoved(object sender, GridCurrentCellMovedEventArgs e)
{
	GridCurrentCell cc = this.gridDataBoundGrid1.CurrentCell;
	if(cc.MoveFromColIndex == 2)
	{
		this.gridDataBoundGrid1.Binder.DirectSaveCellInfo = true;
		this.gridDataBoundGrid1[cc.MoveFromRowIndex,3].CellValue = 123.123;
		this.gridDataBoundGrid1.Binder.DirectSaveCellInfo = false;
	}
}


AD Administrator Syncfusion Team May 2, 2005 03:25 AM UTC

that wont work because i need the row col before the move. i''d recommend these two issues get fixed ASAP anyway, so i''ll wait for a fix in my direct track, we are going to prod now so sooner the better. thanks


AD Administrator Syncfusion Team May 2, 2005 07:50 AM UTC

The CurrentCell.MoveFromRowIndex and CurrentCell.MovefromColIndex that I used in my snippet give you the current row and column index from before the move in CurrentCellMoved. If you want to do this from CurrentCellMoving, the call this.gridDataBoundGrid1.CurrentCell.ConfirmChanges(); to save the changes on the CurrentCell before you set DirectSaveCellInfo to true to change the other value.


AD Administrator Syncfusion Team May 2, 2005 02:02 PM UTC

yes adding this.gridDataBoundGrid1.CurrentCell.ConfirmChanges(); works fine thanks again

Loader.
Up arrow icon