如何在javascript中使用mvc中的devexpress gridview的复选框选择来获取所有选定的行键值

时间:2023-01-01 12:42:35

I am using devexpress gridview in mvc with checkboxes. I want all selected checkbox key values of gridview to controller when i am selecting some checkboxes with paging in gridview

我在mvc中使用devexpress gridview和复选框。当我在gridview中选择一些带分页的复选框时,我希望所有选中的gridview的复选框键值都能控制器

2 个解决方案

#1


1  

Use recommendations from the How to get all GridView selected keys and pass them to a Controller sample.

使用如何获取所有GridView选定键的建议,并将它们传递给Controller示例。

#2


0  

Key values of all selected checkboxes in the gridview can be retrieved by iterating though all the rows of gridview one by one using a simple loop and checking if the checkbox is selected or not. If yes you can retrieve key value of that row using built in functions(sorry i don't remember the function name, that you need to look yourself) and save the retrieved values in an array. These values can then be passed on to controller. Remember, everytime you check/uncheck even one box you still need to iterate all rows again. Hope it would solve your problem.

通过使用简单循环逐个遍历gridview的所有行并检查是否选中了复选框,可以检索gridview中所有选中复选框的键值。如果是,您可以使用内置函数检索该行的键值(抱歉我不记得您需要查看的函数名称)并将检索到的值保存在数组中。然后可以将这些值传递给控制器​​。请记住,每次检查/取消选中一个框时,您仍需要再次迭代所有行。希望它能解决你的问题。

#1


1  

Use recommendations from the How to get all GridView selected keys and pass them to a Controller sample.

使用如何获取所有GridView选定键的建议,并将它们传递给Controller示例。

#2


0  

Key values of all selected checkboxes in the gridview can be retrieved by iterating though all the rows of gridview one by one using a simple loop and checking if the checkbox is selected or not. If yes you can retrieve key value of that row using built in functions(sorry i don't remember the function name, that you need to look yourself) and save the retrieved values in an array. These values can then be passed on to controller. Remember, everytime you check/uncheck even one box you still need to iterate all rows again. Hope it would solve your problem.

通过使用简单循环逐个遍历gridview的所有行并检查是否选中了复选框,可以检索gridview中所有选中复选框的键值。如果是,您可以使用内置函数检索该行的键值(抱歉我不记得您需要查看的函数名称)并将检索到的值保存在数组中。然后可以将这些值传递给控制器​​。请记住,每次检查/取消选中一个框时,您仍需要再次迭代所有行。希望它能解决你的问题。