Hello,
I have 5 checkboxes in one record in the datagrid. When the user checks 5th
checkbox (or, in my case, clicks the button - doesn't matter to me), all
other checkboxes are checked as well.
I've done it in SelectedIndexChanged event. My code is below.
However, it takes too long to work on the server side. I'm sure it is
possible to do the same in Javascript. Unfortunatley, I don't know it that
well. I've found many examples how to select all checkboxes in one column
using JS, but couldn't find anithing about selecting them in one row.
Could you please tell me how to do this in JS? I would appreciate it very
much.
My VB.NET code is here:
Private Sub dgData_SelectedIndexChanged(ByVal sender As Object, ByVal e As
System.EventArgs) Handles dgData.SelectedIndexChanged
Try
Dim chk As CheckBox, btn As Button
Dim i As String = dgData.DataKeys(dgData.SelectedIndex.ToString)
btn = CType(dgData.SelectedItem.FindControl("btnAll"), Button)
chk = CType(dgData.SelectedItem.FindControl("chkFront"), CheckBox)
If chk.Checked = False Then
chk = CType(dgData.SelectedItem.FindControl("chkPayout") , CheckBox)
chk.Checked = True
chk = CType(dgData.SelectedItem.FindControl("chkVarData" ), CheckBox)
chk.Checked = True
chk = CType(dgData.SelectedItem.FindControl("chkQA"), CheckBox)
chk.Checked = True
chk = CType(dgData.SelectedItem.FindControl("chkFront"), CheckBox)
chk.Checked = True
chk = CType(dgData.SelectedItem.FindControl("chkEPS"), CheckBox)
chk.Checked = True
btn.BackColor = Color.FromKnownColor(6699)
Else
chk = CType(dgData.SelectedItem.FindControl("chkPayout") , CheckBox)
chk.Checked = False
chk = CType(dgData.SelectedItem.FindControl("chkVarData" ), CheckBox)
chk.Checked = False
chk = CType(dgData.SelectedItem.FindControl("chkQA"), CheckBox)
chk.Checked = False
chk = CType(dgData.SelectedItem.FindControl("chkFront"), CheckBox)
chk.Checked = False
chk = CType(dgData.SelectedItem.FindControl("chkEPS"), CheckBox)
chk.Checked = False
btn.BackColor = Color.White
End If
--
Peter Afonin