Moving column and column Index

Posted by: amdavid on 29 January 2019, 8:15 pm EST

    • Post Options:
    • Link

    Posted 29 January 2019, 8:15 pm EST

    Hi ! I’ll do me best to be clear… let say that I have a grid with 25 columns. Each column have a name. User can move columns to adjust column order if needed. All columns are editable. I have an afterEdit event raised to validate some stuff after the data is edited. If people can move colume aroud, how can I, in the afterEdit work with the columnName instead of the column index ? 'Cause column 6 may not longer be the 6th column… I hope you understand what I mean !!!

    Thanks for your help !!

  • Posted 30 January 2019, 1:39 am EST

    Hello,

    I would suggest you to get the index of the column you are expecting and then compare it with the e.Col value, as follows:```

    private void C1FlexGrid1_AfterEdit(object sender, C1.Win.C1FlexGrid.RowColEventArgs e)

    {

    var colIndex = c1FlexGrid1.Cols.IndexOf(“Designation”);

    if (colIndex == e.Col)

    {

    // validation passed

    }

    else

    {

    // validation failed

    }

    }

    Let me know, if this is not what you needed.
    
    Thanks,
    Ruchir
  • Posted 30 January 2019, 10:26 am EST

    Awesome… thanks a lot !!

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels