Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
755
How to select the whole column in ultragrid
posted

Hi,

I am using ultra-grid in my windows application.can anyone tell me how to select the whole column of a ultra-grid and change all entries to the same value.

Thanks in advance,Please Help me out.

  • 469350
    Offline posted

    Hi Saroj,

    There's no built-in UI in the grid to change an entire column.

    A user can select a column by clicking on the column header. This depends on the HeaderClickAction property on the override and also on the SelectTypeCol property. These have to be set up to allow selecting a column (or columns), of course.

    You could provide the user with a button or a context menu or some other UI to change all of the cells in the selected column(s). The code to change the value of every cell is pretty simple. Here's what I would do:


            private void button1_Click(object sender, EventArgs e)
            {
                if (this.ultraGrid1.Selected.Cells.Count == 0)
                    return;

                foreach (UltraGridCell cell in this.ultraGrid1.Selected.Cells)
                {
                    cell.Value = newValue;
                }

                // The code above will leave every row with a pending edit (a pencil will display in
                // the RowSelector. So commit the changes here.
                this.ultraGrid1.UpdateData();
            }