FlexGrid, columns in mixed mode (bound and unbound)

Posted by: a.sharov on 12 April 2022, 2:05 pm EST

    • Post Options:
    • Link

    Posted 12 April 2022, 2:05 pm EST

    Hi.

    I have FlexGrid which is bounded to some datasource, it shows and edit bounded (backed by data field) columns fine, but I also added two unbounded columns in designer which is not backed by any field in datasource. How can I assign values to these unbounded columns (cells)?

    For example, I have code like this for column with textbox and ellipse button:

     
    private void C1DebugPathCellButtonClick(object sender, RowColEventArgs e)
            {
                var folderBrowserDialog = new FolderBrowserDialog
                {
                        Description = @"Select the directory.", 
                        ShowNewFolderButton = false
                };
    
                var result = folderBrowserDialog.ShowDialog();
                if (result == DialogResult.OK)
                {
                    c1FlexGrid[e.Row,e.Col] =  folderBrowserDialog.SelectedPath;
                }
            }
    
    

    but nothing in column changes.

    Edition is allowed per grid and column.

    What I’m missing, what else should I check or change?

    Thanks in advance.

  • Posted 13 April 2022, 12:44 am EST

    Hi,

    The C1FlexGrid fires the GetUnboundValue and SetUnboundValue events whenever the Grid wants to get and set the values for the Unbound column cells. To edit the values of the Unbound column cells, you will need to handle these events and maintain the values for the unbound cells of each row in your code separately (for eg. in a Dictionary). Then, you can get or set the value for the unbound column cells in the dictionary and the Grid will automatically fetch the values from there. Kindly refer to the attached sample showing the approach mentioned above.

    You can also refer to the documentation link below which explains using Unbound columns in a bound C1FlexGrid.

    https://www.grapecity.com/componentone/docs/win/online-flexgrid/bound-mode-operations.html#i-heading-adding-unbound-column-in-bound-mode

    Kind Regards,

    Kartik

    UnboundColumns_FG.zip

Need extra support?

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

Learn More

Forum Channels