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

H

haresh.amis

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
(e-mail address removed)
thanks
 
B

bruce barker

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

-- bruce (sqlwork.com)
 
H

haresh.amis

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

}

-- bruce (sqlwork.com)



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
(e-mail address removed)
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
 
D

David

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


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

}

-- bruce (sqlwork.com)



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
(e-mail address removed)
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,012
Latest member
RoxanneDzm

Latest Threads

Top