AspxGridview with all checkbox column


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 checkbox 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




1 Answer
1



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;
}






By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Comments

Popular posts from this blog

paramiko-expect timeout is happening after executing the command

how to run turtle graphics in Colaboratory

Export result set on Dbeaver to CSV