AspxGridview with all checkbox column
i have a devexpress grid with
dxwgv:GridViewDataCheckColumn Caption="ONE" FieldName="ONE">
i have all columns with checkbox + there is checkbox on rowselect e.g. checbox | column(checkbox) | column(checkbox) | column(checkbox) | column(checkbox)
the problem is to get the row values when any of the column checkbox is checked/unchecked. i tried using Eval and adding to ClientInstanceName of the 开发者_如何学JAVAcheckbox but sending clientInstanceName to from javascrit as params is problem (i used "chkbox_id.ClientInstanceName" but did not worked)
any help would be greatly appreciated. thanks
Set the client instance name on the grid:
ClientInstanceName="YourGrid"
then add a control some where on the page to allow the user to "Select All" like so:
<input id="chkSelectAll" type="checkbox" onclick="YourGrid.SelectAllRowsOnPage(this.checked);" />
Finally in the code behind you can do something like this:
// aColumnName is the name of the column from which you want the value.
private List<object> GetSelectedRowValues(string aColumnName)
{
List<object> values = new List<object>();
string[] valueToGet = { aColumnName };
for (int i = 0; i < YourGrid.VisibleRowCount; i++)
{
if (YourGrid.Selection.IsRowSelected(i))
{
//get the passed in value for the selected rows.
values.Add(YourGrid.GetRowValues(i, valueToGet));
}
}
return values;
}
精彩评论