problem with Check box selection when multiple gridview exists on the form
I am working on check box selection in a grid view. I have gone though the following link Grid view checkboxes
This works fine when i am having one grid view on my for开发者_Python百科m , but if i have multiple grid views then i am facing a problem in selection. So can any one help me or give me any other alternative solution which works exactly as the link i posted..
My problem is when i am having multiple grid view and selecting one header grid view the items in other grid view are selected so can any one give me the best method to achieve.
I am using master pages too in my application
From your example, you only need to duplicate the function IsMatch(id)
.
Do a IsMatch for each of your grid :
IsMatchGridView1(id)
, IsMatchGridView2(id)
, etc... with thier own pattern : '^GridView1', '^GridView2', etc ...
Then when selecting the parent checkbox from gridview2, if you use the IsMatchGridView2(id)
, you should only select the right checkboxes from the right gridview.
This may help not exactly per your requirement bus some what it helps
http://dotnetspeaks.net/post/Checking-all-CheckBoxes-in-a-GridView-using-JQuery.aspx
Give the function name to another if you are using multiple grid view and also change the check boxes name and give the valid with respect to that function..
Even that code to work with some minor changes too
if you are using master change here in your code
$("#GridView1 input[name$='cbSelect']") to
$("#<%= GridView1.ClientID %> input[name$='cbSelect']")
精彩评论