469,953 Members | 2,229 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,953 developers. It's quick & easy.

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 22670
<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 discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

34 posts views Thread by kpg | last post: by
33 posts views Thread by patrick_woflian | last post: by
15 posts views Thread by webstormcomputers | last post: by
9 posts views Thread by Tuy Solang | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.