Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Datagrid Control > Select multiple checkboxes

Reply
Thread Tools

Select multiple checkboxes

 
 
Peter Afonin
Guest
Posts: n/a
 
      05-11-2005
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


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Select multiple checkboxes Peter Afonin ASP .Net 0 05-11-2005 07:06 PM
Cannot select checkboxes in checkboxlist within repeater. Ratman ASP .Net 2 07-04-2004 02:17 AM
<select tag> - how do I set the current index in a multiple select box? Ferd Berfel Javascript 4 04-06-2004 06:53 PM
select of select box will select multiple in another box palmiere Javascript 1 02-09-2004 01:11 PM
implement "select all" button to select all checkboxes Matt ASP General 2 01-11-2004 01:08 PM



Advertisments