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.

Populate CellValue based on another cell in the row

Thread ID:





9799 Jan 12,2004 08:46 AM Jan 12,2004 11:55 AM Windows Forms 1
Tags: GridControl
Christina Rancilio
Asked On January 12, 2004 08:46 AM

I am trying to link 2 cells together. Basically, if you select from the drop down in column 1 the value in column 2 is automatically populated and vice versa. I am using the CurrentCellEditingComplete() event - I included the code below. Everything is working as expected except one thing. When I tab out of the column 1 cell into the column 2 cell, a new row is created. Why would this happen? Thanks! Christina private void grid_CurrentCellEditingComplete(object sender, System.EventArgs e) { GridDataBoundGrid g = (GridDataBoundGrid) sender; int c = g.CurrentCell.ColIndex; int r = g.CurrentCell.RowIndex; switch(c) { case 1: if(g[r, 1].Text != g[r,2].FormattedText) { g[r,2].CellValue = g[r, 1].Text; } break; case 2: if(g[r, 2].Text != g[r,1].FormattedText) { g[r,1].CellValue = g[r, 2].Text; } break; } }

Administrator [Syncfusion]
Replied On January 12, 2004 11:55 AM

Try this. Before doing g[r,2].CellValue = g[r, 1].Text;, try calling g.Binder.BeginEdit() to see if this takes care of the problem.


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.