Wijmo Grid

Posted by: roger.porter on 19 December 2017, 11:32 pm EST

  • Posted 19 December 2017, 11:32 pm EST

    Hi,

    Can anyone tell me how I get a list of selected rows in a grid. I know how to get the row indicies but I need to get one of the columns per selected row.

    Many Thanks,

    Roger
  • Marked as Answer

    Replied 20 December 2017, 7:13 pm EST

    Hi Rogger,
    Please refer to the following demo sample for the same:
    http://demo.componentone.com/aspnet/ControlExplorer/C1GridView/CurrentCell.aspx

    ~Manish
  • Replied 17 December 2018, 4:03 pm EST

    You may try this code. It worked for me

    private void selectedColumnsButton_Click(object sender, System.EventArgs e)
    {
    Int32 selectedColumnCount = dataGridView1.Columns
    .GetColumnCount(DataGridViewElementStates.Selected);
    if (selectedColumnCount > 0)
    {
    System.Text.StringBuilder sb = new System.Text.StringBuilder();

    for (int i = 0; i < selectedColumnCount; i++)
    {
    sb.Append("Column: ");
    sb.Append(dataGridView1.SelectedColumns[i].Index
    .ToString());
    sb.Append(Environment.NewLine);
    }

    sb.Append("Total: " + selectedColumnCount.ToString());
    MessageBox.Show(sb.ToString(), "Selected Columns");
    }
    }
  • Replied 17 December 2018, 9:20 pm EST

    Hi Rahil,
    Thanks for sharing your code here, The code is related to the find the selected columns however the original question is related to find the selected rows.

    ~Manish
Need extra support?

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

Learn More

Forum Channels