Hi All
I was looking for a way to loop the entire grid and count all checked fields,
i came up with the following fucntion and i thought i would post it here in case anyone could use it.
Regards
Cush
I was looking for a way to loop the entire grid and count all checked fields,
i came up with the following fucntion and i thought i would post it here in case anyone could use it.
Regards
Cush
Private
Function
Get_CountGridCheckBox(
ByVal
SelGrid
As
RadGrid,
ByVal
ColName
As
String
,
ByVal
ChkBoxVal
As
Boolean
)
As
Integer
Dim
RtnVal
As
Integer
Dim
currentPageIndex
As
Integer
= SelGrid.CurrentPageIndex
'Set initial value to zero
RtnVal = 0
For
i
As
Integer
= 0
To
SelGrid.PageCount - 1
' Loop current page and count check box values
For
Each
item
As
GridDataItem
In
SelGrid.Items
Dim
CheckBx
As
CheckBox =
DirectCast
(item(ColName).Controls(0), CheckBox)
Dim
CheckBxVal
As
Boolean
= CheckBx.Checked
If
CheckBxVal = ChkBoxVal
Then
RtnVal += 1
End
If
Next
' Go to next Grid page
currentPageIndex += 1
If
currentPageIndex >= SelGrid.PageCount
Then
currentPageIndex = 0
End
If
SelGrid.CurrentPageIndex = currentPageIndex
SelGrid.Rebind()
Next
'Return Result
Return
RtnVal
End
Function