0
votes

I have a Devexpress Data Grid with a number of rows loaded.

The following properties are set:

MultiSelectNode=CheckBoxRowSelect

MultiSelect=True

I have a function that iterates through all the Rows and checks, gridview1.IsRowSelected(x) = True.

However the problem is, that even with the checkbox selected is checked it never shows as true.

The following code returns 0

Debug.Print(GridView1.GetSelectedRows().Count)

Is there an easy way to check if the checkbox is checked?

Thanks

2
Not sure about that 3P control, but usually there is a difference between Checked and Selected - Ňɏssa Pøngjǣrdenlarp
Did you manage to try the GetSelectedFieldValues(...) method? Still doesn't work? - andrews

2 Answers

0
votes

the following piece has been working for me in various parts of my app:

  1. First specify the key field name which your datasource collection uses:

    <dvx:ASPxGridView ID="xgvGrid" runat="server" KeyFieldName="ID" ... >
    ...
    </dvx:ASPxGridView>

  2. Then access selected rows IDs by:

    ...
    List<object> values = xgvGrid.GetSelectedFieldValues("ID");
    ...
    You can obtain the selected row's count by calling values.Count afterwards.

HTH

0
votes

Upon closer examination of the code a refresh method was being called which interfered with the grid .getselectedrowsmethod.