Home Forums WinForms controls Xceed Grid for WinForms endedit in non-bound grid not working? C#

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • User (Old forums)
    Member
    Post count: 23064
    #15066 |

    Using these techniques in VB.Net I am able to change the display on an unbound grid from “Y” to “N” on a column that is not read only and of string type. In C# it is not working.

    private void celldataRowTemplate1column12_DoubleClick(object sender, System.EventArgs e)
    {
    Xceed.Grid.DataRow dR;

    try
    {
    dR = ((Xceed.Grid.DataRow)(this.gridMain.CurrentRow));
    dR.BeginEdit();
    if (dR.Cells[“Tiered”].Value == “Y”)
    {
    dR.Cells[“Tiered”].Value = “N”;
    }
    else
    {
    dR.Cells[“Tiered”].Value = “Y”;
    }
    dR.EndEdit();

    }
    catch (Exception ex)
    {
    MessageBox.Show (this,”Can Not Change Table | ” + ex.Message,”Error”,MessageBoxButtons.OK,MessageBoxIcon.Error);
    }
    }

    Imported from legacy forums. Posted by Gary (had 3231 views)

    User (Old forums)
    Member
    Post count: 23064

    btw, the code runs w/o error — just doesn’t change the display

    Imported from legacy forums. Posted by Gary (had 307 views)

    User (Old forums)
    Member
    Post count: 23064

    Remove the BeginEdit and EndEdit method calls, and it should be working fine.

    What is happening is that by calling these methods, the row gets in editing mode, which means that all changes to the row’s values will be coming from the cell editors, and not form the cell values. Thus when leaving this mode, it reverts back to the old value, because none of the editors values changed, only the cell values.

    In sum, you don’t need to enter editing mode when changing a cell value through code.

    Imported from legacy forums. Posted by André (had 239 views)

    User (Old forums)
    Member
    Post count: 23064

    Thank you. Interestingly, the value is changing as I track it in code, and the valuechanged event is running, but the display is not.

    Imported from legacy forums. Posted by Gary (had 175 views)

    User (Old forums)
    Member
    Post count: 23064

    Send a sample application reproducing the issue to <a href=”mailto:support@xceedsoft.com”>support</a>, and we will investigate this further.

    Imported from legacy forums. Posted by André (had 4284 views)

Viewing 5 posts - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.