Hi,
put 2 server button controls on your webpage:
btnCheck - which checks all checkboxes called cbxFChk
btnUncheck - which unchecks all checkboxes called cbxFChk
( cbxFChk being the name of your checkbox items in your
HTML code in your question
dim tdnew as tablecell
tdNew.Text = "<input type='checkbox' id='cbxFChk'
Name='cbxFChk' Value ='" & dsSet.Tables(0).Rows(i).Item
("Productid") & "'>"
then add these 3 subs to your code which will check/uncheck
all occurences of chkFChk checkboxes - see following code
Private Sub btnCheck_Click(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles btnSelectAll.Click
SetSelected(True) 'checks the check box
End Sub
Private Sub btnUncheck_Click(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles Button1.Click
SetSelected(False) ' uncheck the check boxes
End Sub
Private Sub SetSelected(ByVal fState As Boolean)
Dim i As Integer
Dim aItem As DataGridItem
Dim aCheck As CheckBox
For i = 0 To gridSR.Items.Count - 1
aItem = gridSR.Items.Item(i)
'find all occurences of checkboxes in the datagrid
'...that are called cbxFChk
aCheck = aItem.FindControl("cbxFChk")
aCheck.Checked = fState ' set checked property true/false
Next
End Sub
Hope this helps you. if you need the Javascript code to set the
checkboxes using HTML client side controls - then let me know and
i will getback to you.
best of luck
Chas (Canterbury, UK)
|