我最终做了一些客户端的事情。首先,我添加了这一列:
<dx:GridViewCommandColumn ShowSelectCheckbox="True" VisibleIndex="0" Width="40">
<HeaderTemplate>
<dx:ASPxCheckBox ID="SelectAllCheckBox" runat="server" ToolTip="Select/Unselect all rows on the page"
ClientSideEvents-CheckedChanged="function(s, e) { gridView.SelectAllRowsOnPage(s.GetChecked()); }" />
</HeaderTemplate>
</dx:GridViewCommandColumn>
然后我也添加了这个(到同一个网格):
<ClientSideEvents SelectionChanged="grid_SelectionChanged" />
最后,javascript:
var selected = [];
function grid_SelectionChanged(s) {
s.GetSelectedFieldValues("ID", GetSelectedFieldValuesCallback);
}
function GetSelectedFieldValuesCallback(values) {
selected = [];
for (var i = 0; i < values.length; i++) {
selected.push(values[i]);
}
}