Click here to Skip to main content
15,904,415 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi there,

I have a requirement where I have a datagrid. In the datagird i have a checkbox column and other columns in which one of them is customer id, What i need is if I select the checkbox against the customer id 101, it should autoselect the other checkboxes which are having the customer id 101 in the same datagrid and if i unselect 101, it should unselect all checkboxes for customer id 101. Please help
Posted
Updated 15-Apr-13 1:12am
v3
Comments
PrashantSonewane 15-Apr-13 7:15am    
Add your code here so far you have tried..

While adding checkbox to Grid also add one attribute for CustomerID in it.
So when you check/uncheck any checkbox then find CustomerID of it and using jQuery selectors[^] find other checkboxes having same CustomerID and check/uncheck them.

Check sample on jsFiddle
http://jsfiddle.net/xqQUr/[^]
 
Share this answer
 
Comments
SharanKumar1988 15-Apr-13 8:41am    
I have very less idea on using Jquerys nd I m into .net 2003. Am trying with OnCheckedChanged() event of the checkbox. But I am not getting the logic on how to autoselect base don customer id.
are you using INotifyPropertyChanged...if so bind the Checked property of the checkbox to a property which automatically updates the values ...
For more info on tis, plz check this link
http://codepronet.blogspot.com/2009/08/implementing-inotifypropertychanged.html[^]

Bind Better with INotifyPropertyChanged[^]

Else on OnCheckedChanged() event of the checkbox, you need to go through all the items in a grid and change their selection manually
 
Share this answer
 
v2
Comments
SharanKumar1988 15-Apr-13 8:41am    
I have very less idea on using Jquerys nd I m into .net 2003. Am trying with OnCheckedChanged() event of the checkbox. But I am not getting the logic on how to autoselect base don customer id.
SharanKumar1988 15-Apr-13 8:43am    
This is what i am trying now in OnCheckedChanged event..
Dim objThisItem As DataGridItem
Dim intRow As Integer = 0
Dim Status As String
Dim i As Integer
Dim blnChecked As Boolean
Dim intRows As Integer = dgActivecom.Items.Count - 1
Dim Customer As String
Dim Comments As String
Dim CustomerSave As String
For intRow = 0 To intRows

objThisItem = dgActivecom.Items(intRow)
blnChecked = DirectCast(objThisItem.FindControl("chkExclude"), CheckBox).Checked
If (blnChecked = True) Then

Customer = Trim(dgActivecom.Items(intRow).Cells(1).Text)
Response.Write(Customer + "_True" + " ")
Else
Customer = Trim(dgActivecom.Items(intRow).Cells(1).Text)
Response.Write(Customer + "_False" + "")
End If
I have very less idea on using Jquerys nd I m into .net 2003. Am trying with OnCheckedChanged() event of the checkbox. But I am not getting the logic on how to autoselect base don customer id.
 
Share this answer
 
I have used the checkchange property and in the checkchange property i have looped through the datagrid and in put a condition to check any selected checkbox. IF any selected checkbox, it calls another functtion which again loops thtough the datagrid and select for all that particular customer which I saved earlier into a string.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900