473,465 Members | 1,901 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Select multiple checkboxes

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
Nov 19 '05 #1
0 1286

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: Ralph Freshour | last post by:
I have multiple checkbox's created with an array name because I have many on the same web page - their names are like: frm_chk_delete frm_chk_delete frm_chk_delete frm_chk_delete etc. Here...
1
by: Marek Mänd | last post by:
<select multiple style="height:200px;"> <option>a <option>b </select> Why does Mozilla draw the vertical scrollbar to the SELECT html element? There is plenty of void room below two OPTIONs in...
12
by: Forti2ude | last post by:
Hello, I have a simple form... <form> <select name="foo" multiple> <option value="1">one</option> <option value="2">two</option> <option value="3">three</option> </select>
2
by: George Durzi | last post by:
This is more of a design/philosophical question :) I have a page in which the user sets attributes for a project. There are 8 attributes, e.g. Project Type, Country, etc. The number of options...
6
by: Terry | last post by:
Good morning! How do I determine which SELECT button was clicked in a GridView? The multiple SELECT buttons will be used for an application approval process. Thank you in advance for your...
5
by: Sonnich | last post by:
Can anyone give me a quick hint for this? Say, I have: <SELECT NAME="opt3" SIZE="15" multiple> Then I'd like to list the items selected... echo $_POST; but this gives only the first one ...
3
by: Robert Kilroy | last post by:
Greetings, I've been working on this for a few hours now. It seems to be a pretty simple task but I keep running into " has no properties". I have a select box defined as follows: <SELECT...
5
by: TechnoAtif | last post by:
Hi All..'mAtif..i've got stuck within checkboxes these days..i've got many input items like checkboxes,textarea and along with them there are many checkboxes...all the data except the checkbox's is...
3
by: camdev | last post by:
I have a form with 2 radio buttons and multiple checkboxes (see example below). The one radio button indicates all and the other radio button indicates the user has chosen specific options...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.