473,466 Members | 1,456 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

how can i count checked check box in checkboxlist by java script? hlp me

hello to all,

I m using .net 2.0 and i face a problem that is as under
Well I have a checkboxlist which i bound in .cs page
now I want to count that how many checkboxes ate checked ( In
javascript ) and
checked checkboxes text will be concat and that string will be pass on
to report query

I m trying on by this code but it's not work
so have you great mind and great idea for this then pls tell me.
Code:
which I refere for count checked checkboxes

alert(frm.Chkboxlist);
for (var i=0; i<frm.Chkboxlist.items.count-1;i++)
{
alert('i=' + i);
if(frm.Chkboxlist.items.checked)
{
alert(str);
str = frm.Chkboxlist.selecteditems + ' ';
}
}

Hope for quick reply

you can mail me on
ha***********@yahoo.co.in
thanks

Apr 18 '07 #1
4 22826
<ha*********@gmail.comwrote in message
news:11*********************@e65g2000hsc.googlegro ups.com...
I m trying on by this code but it's not work
In what way is it not working...?
Apr 18 '07 #2

var count = 0;
var els = document.getElementsByTagName('input');
for (var i=0; i < els.length; ++i)
{
var e = els[i];
if (e.type == 'checkbox'
&& e.name == '<%=ChkBoxList.UniqueID%>'
&& e.checked)
++count;
}

-- bruce (sqlwork.com)
ha*********@gmail.com wrote:
hello to all,

I m using .net 2.0 and i face a problem that is as under
Well I have a checkboxlist which i bound in .cs page
now I want to count that how many checkboxes ate checked ( In
javascript ) and
checked checkboxes text will be concat and that string will be pass on
to report query

I m trying on by this code but it's not work
so have you great mind and great idea for this then pls tell me.
Code:
which I refere for count checked checkboxes

alert(frm.Chkboxlist);
for (var i=0; i<frm.Chkboxlist.items.count-1;i++)
{
alert('i=' + i);
if(frm.Chkboxlist.items.checked)
{
alert(str);
str = frm.Chkboxlist.selecteditems + ' ';
}
}

Hope for quick reply

you can mail me on
ha***********@yahoo.co.in
thanks
Apr 18 '07 #3
On Apr 18, 8:37 pm, bruce barker <nos...@nospam.comwrote:
var count = 0;
var els = document.getElementsByTagName('input');
for (var i=0; i < els.length; ++i)
{
var e = els[i];
if (e.type == 'checkbox'
&& e.name == '<%=ChkBoxList.UniqueID%>'
&& e.checked)
++count;

}

-- bruce (sqlwork.com)

haresh.a...@gmail.com wrote:
hello to all,
I m using .net 2.0 and i face a problem that is as under
Well I have a checkboxlist which i bound in .cs page
now I want to count that how many checkboxes ate checked ( In
javascript ) and
checked checkboxes text will be concat and that string will be pass on
to report query
I m trying on by this code but it's not work
so have you great mind and great idea for this then pls tell me.
Code:
which I refere for count checked checkboxes
alert(frm.Chkboxlist);
for (var i=0; i<frm.Chkboxlist.items.count-1;i++)
{
alert('i=' + i);
if(frm.Chkboxlist.items.checked)
{
alert(str);
str = frm.Chkboxlist.selecteditems + ' ';
}
}
Hope for quick reply
you can mail me on
haresh_can...@yahoo.co.in
thanks- Hide quoted text -

- Show quoted text -
thanks for quick reply me

Still I face this problem

I once again repeat my problem

I want to count that how manycheckboxes are checked in the
checkboxlist
the checkboxlist is run time filled (by Data binding)
I can not track or count that how many checkboxes are there
can you tell me how can i refere checkbox of a checkboxlist?(keep in
mind that i m not using array for filling checkboxlist)
I have already use for this like checkboxlist.count ( but it's not
work)
have you any example for this?
pls help me ASAP

thanks

Apr 20 '07 #4
Surely, if you are binding it at run time, then you should now how many rows
you are binding to it... Can't you count the rows here?

Alternatively, do the count in the ondatabind of the checkboxes...

--
Best regards,
Dave Colliver.
http://www.AshfieldFOCUS.com
~~
http://www.FOCUSPortals.com - Local franchises available
<ha*********@gmail.comwrote in message
news:11**********************@o5g2000hsb.googlegro ups.com...
On Apr 18, 8:37 pm, bruce barker <nos...@nospam.comwrote:
>var count = 0;
var els = document.getElementsByTagName('input');
for (var i=0; i < els.length; ++i)
{
var e = els[i];
if (e.type == 'checkbox'
&& e.name == '<%=ChkBoxList.UniqueID%>'
&& e.checked)
++count;

}

-- bruce (sqlwork.com)

haresh.a...@gmail.com wrote:
hello to all,
I m using .net 2.0 and i face a problem that is as under
Well I have a checkboxlist which i bound in .cs page
now I want to count that how many checkboxes ate checked ( In
javascript ) and
checked checkboxes text will be concat and that string will be pass on
to report query
I m trying on by this code but it's not work
so have you great mind and great idea for this then pls tell me.
Code:
which I refere for count checked checkboxes
alert(frm.Chkboxlist);
for (var i=0; i<frm.Chkboxlist.items.count-1;i++)
{
alert('i=' + i);
if(frm.Chkboxlist.items.checked)
{
alert(str);
str = frm.Chkboxlist.selecteditems + ' ';
}
}
Hope for quick reply
you can mail me on
haresh_can...@yahoo.co.in
thanks- Hide quoted text -

- Show quoted text -

thanks for quick reply me

Still I face this problem

I once again repeat my problem

I want to count that how manycheckboxes are checked in the
checkboxlist
the checkboxlist is run time filled (by Data binding)
I can not track or count that how many checkboxes are there
can you tell me how can i refere checkbox of a checkboxlist?(keep in
mind that i m not using array for filling checkboxlist)
I have already use for this like checkboxlist.count ( but it's not
work)
have you any example for this?
pls help me ASAP

thanks

Apr 20 '07 #5

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

Similar topics

2
by: jayuya | last post by:
How can i check in java script if a asp.net radio button list server control is selected? I have some custom javascript function in the client side that needs to run but I don't see the way to...
6
by: Daniel Walzenbach | last post by:
Hi, I have an application using "Forms authentication". Everything works perfectly well except when I try to open a new page with java script like the following: <script...
34
by: kpg | last post by:
Hello all, I have an asp.net web application with tons of Java script files. I would like to protect the Java Script somehow so it can't be seen by a remote user. I found several 3rd party...
33
by: patrick_woflian | last post by:
hey guys, im just writing a basic calculation at the moment, before building on it for an A-Level piece of work. i can add/divide etc... two numbers together yet i am having a major problem with...
15
by: webstormcomputers | last post by:
I'm trying to update a hidden field with java script and I'm only getting one of the values from my select stament. Here is the code below. <select name="on0"> <option value="25">25 <option...
1
by: ilaxi kandoliya | last post by:
Hi, I have developing project with asp.net 2.0 (C#) I have used java script function in my code but if User's browser is java script disable then its not working properly so how to check Browser...
9
by: Tuy Solang | last post by:
I download four scripts that are used to display Khmer PGN for Khmer Chess. It works fine with Netscape 7.1 on MS Millenium, but it gave me an error(Java Script console) with Netscape 8.1 on MS...
2
by: darkminos | last post by:
Hi, I have the following code int countCheckState = 0 for (int i = 0; i < CheckboxList.Count; i++) { if (CheckboxList.Checked) countCheckState++ if (countCheckState == 0)
5
by: usha535140 | last post by:
Hi, In the intial page I want to dispay a check box ie for the first time I should display the page with check box ,If the check box is checked i need to dispaly the tabcontainer with the tabs.If it...
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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
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
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
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: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...

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.