hai..
am having a checkboxlist..n ow how do i get the value of the checkbox
that is checked in checkboxlist using javascript?
Thanks in advance....
Regards,
Satheesh 14 7970
Try looking at this sample at:- http://authors.aspalliance.com/das/d...dcheckbox.aspx
Hope that helps
Patrick
"Satheesh Babu B" <b.************ @gmail.com> wrote in message
news:11******** **************@ o13g2000cwo.goo glegroups.com.. . hai.. am having a checkboxlist..n ow how do i get the value of the checkbox that is checked in checkboxlist using javascript? Thanks in advance....
Regards, Satheesh
Thanks for ur reply patrich but it did'nt solve my problem..pls help
me..
how to retrive the value of checkbox that is checked in checkboxlist
using javascript..
Regards,
Satheesh
i have used the coding..
document.getEle mentById('Check BoxList1_0').va lue;
but it is giving the result as on. how to accomplish this one???
regards,
Satheesh
well, you can do this in two ways:
1. (Not a good one) ids for checkboxes in checkboxlists are created like
this:
"nameOfAcheckbo xlist_nextNumbe r"
so you can loop
for (i = 0; i < number; i++)
{
if (document.getEl ementByID("chec kboxlistName_" + i ).checked)
{
//do something
}
}
or
2. (Better one) On server side create a javascript array that contains
checkbox'es .ClientID
And on a client side loop through this array.
for (i = 0; i < idsArray.length ; i++)
{
if (document.getEl ementByID(idsAr ray[i]).checked)
{
//do something
}
}
hope this helps.
"Satheesh Babu B" <b.************ @gmail.com> wrote in message
news:11******** **************@ o13g2000cwo.goo glegroups.com.. . hai.. am having a checkboxlist..n ow how do i get the value of the checkbox that is checked in checkboxlist using javascript? Thanks in advance....
Regards, Satheesh
What i can advice you is try viewing the source code of the page and you
will see the
Id created for the checkboxlist which i guess it would be similar to what
you posted..
Is you Checkboxlist in any other control or are you databinding your
Checkboxlist
Post more info
PAtrick
"Satheesh Babu B" <b.************ @gmail.com> wrote in message
news:11******** **************@ z14g2000cwz.goo glegroups.com.. . i have used the coding..
document.getEle mentById('Check BoxList1_0').va lue;
but it is giving the result as on. how to accomplish this one???
regards, Satheesh
The code generated is...
<table id="CheckBoxLis t1" border="0" style="Z-INDEX: 104; LEFT: 384px;
POSITION: absolute; TOP: 112px">
<tr>
<td><input id="CheckBoxLis t1_0" type="checkbox"
name="CheckBoxL ist1:0" /><label for="CheckBoxLi st1_0">one</label></td>
</tr><tr>
<td><input id="CheckBoxLis t1_1" type="checkbox"
name="CheckBoxL ist1:1" /><label for="CheckBoxLi st1_1">2</label></td>
</tr><tr>
<td><input id="CheckBoxLis t1_2" type="checkbox"
name="CheckBoxL ist1:2" /><label for="CheckBoxLi st1_2">3</label></td>
</tr><tr>
<td><input id="CheckBoxLis t1_3" type="checkbox"
name="CheckBoxL ist1:3" /><label for="CheckBoxLi st1_3">4</label></td>
</tr>
</table>
Regards,
Satheesh
Is it DataBinded or is it in any other controls?
Patrick
"Satheesh Babu B" <b.************ @gmail.com> wrote in message
news:11******** **************@ o13g2000cwo.goo glegroups.com.. . The code generated is...
<table id="CheckBoxLis t1" border="0" style="Z-INDEX: 104; LEFT: 384px; POSITION: absolute; TOP: 112px"> <tr> <td><input id="CheckBoxLis t1_0" type="checkbox" name="CheckBoxL ist1:0" /><label for="CheckBoxLi st1_0">one</label></td> </tr><tr> <td><input id="CheckBoxLis t1_1" type="checkbox" name="CheckBoxL ist1:1" /><label for="CheckBoxLi st1_1">2</label></td> </tr><tr> <td><input id="CheckBoxLis t1_2" type="checkbox" name="CheckBoxL ist1:2" /><label for="CheckBoxLi st1_2">3</label></td> </tr><tr> <td><input id="CheckBoxLis t1_3" type="checkbox" name="CheckBoxL ist1:3" /><label for="CheckBoxLi st1_3">4</label></td> </tr> </table>
Regards, Satheesh
"Satheesh Babu B" <b.************ @gmail.com> wrote in message
news:11******** **************@ z14g2000cwz.goo glegroups.com.. . i have used the coding..
document.getEle mentById('Check BoxList1_0').va lue;
but it is giving the result as on. how to accomplish this one???
I'm not sure what your problem is. When a checkbox is checked, it has a
value of 'on' - when it's not, it doesn't...
<script>
if(document.get ElementById('Ch eckBoxList1_0') .value == 'on')
{
alert('Checked' );
}
else
{
alert('Not checked');
}
</script>
Co slychac Sebastian?
"Sebastian Wojciechowski" <sebastian_usen et :this funny sign: icsharp.net>
wrote in message news:Oz******** ******@TK2MSFTN GP09.phx.gbl... well, you can do this in two ways:
1. (Not a good one) ids for checkboxes in checkboxlists are created like this: "nameOfAcheckbo xlist_nextNumbe r"
so you can loop
for (i = 0; i < number; i++) { if (document.getEl ementByID("chec kboxlistName_" + i ).checked) { //do something } }
or
2. (Better one) On server side create a javascript array that contains checkbox'es .ClientID And on a client side loop through this array.
for (i = 0; i < idsArray.length ; i++) { if (document.getEl ementByID(idsAr ray[i]).checked) { //do something } }
hope this helps.
"Satheesh Babu B" <b.************ @gmail.com> wrote in message news:11******** **************@ o13g2000cwo.goo glegroups.com.. . hai.. am having a checkboxlist..n ow how do i get the value of the checkbox that is checked in checkboxlist using javascript? Thanks in advance....
Regards, Satheesh
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Itai |
last post by:
I am attempting to create an ASP.NET Custom Validator javascript for a
checkboxlist control. My goal is to limit the total number of
selections to be 1 - 5 at most. My problem is that I get a null
reference when I attempt to retrieve an object for an individual list
item, which of course results
in an "object required" error message.
Anyone know what to do? tnx in advance
-Itai.
|
by: Satheesh Babu B |
last post by:
hai..
am having a checkboxlist..now how do i get the value of the checkbox
that is checked in checkboxlist using javascript?
Thanks in advance....
Regards,
Satheesh
|
by: Bryce Budd |
last post by:
Hello All,
I've been a taker of information from newsgroups for a long time and thought
I'd finally make a contribution back to the community whose supported me
when I've needed it. After all before commercialization took over that was
the beauty of the Internet!
I've create a checkboxlist validator control...something MS should have done
originally in my opinion, but nonetheless here it is. It's a C# control,
sort of IE specific. ...
|
by: Robin Day |
last post by:
I run some code on the changed event of checkbox lists. Its quite simple,
nothing more than showing / hiding some other parts of the page.
Using Autopostback and Server side code works fine, but is far too slow,
especially if the users are on modems.
I need to quite simply, add some java code to the onclick event of the input
tags of a checkboxlist.
However... Attributes.Add adds the onclick attribute and code to the
outlying table that...
|
by: Shaul Feldman |
last post by:
Hello,
I have something really awkward at work - fighting with CheckBoxList...
How can I define CSS for ListItem in CheckBoxList programmatically.
I add CheckBoxList's Items on the fly, something like
dim li as ListItem
li = new ListItem("title","value");
'' how to define here the CSS for List Item, not CheckBoxList?!?!?!
myCheckBoxList.Items(x).add(li);
| |
by: Ryan Scully |
last post by:
Hello I have problem with determining exactly what CheckBoxList element is selected using JavaScript code. When I databind to the checkboxlist it renders it on the page and instead of giving each checkbox a value, it gives it a name and does a <label> tag for the Text of the item, and has nothing about the value anywhere in the rendered code for the checkboxlist. So when I enumerate through the controls on the page in javascript, I can never...
|
by: Roy |
last post by:
The title is self-explanatory, but I'll show you all what I've done thus
far.
Here's the aspx side of things(trimmed, of course):
<form name="form1" id="Form1" method="post" runat="server">
<table width="100%">
<tr>
<td>
<asp:CheckBoxList Runat="server" id="CheckBoxList1">
<asp:ListItem Value="a">Checked a</asp:ListItem>
|
by: ThunderMusic |
last post by:
Hi,
I have a CheckBoxList and I want to add some javascript code to each
CheckBox created by this CheckBoxList. I tried iterating through all items
of the list, all the controls, do a FindControl, et al. with no good result.
I would use the Control.Attribute.Add("OnClick", "some javascript code")
Does someone know a solution?
Thanks
|
by: Stimp |
last post by:
I have a checkboxlist (chkMyList) which is created from a (name, value)
pair from a database table.
I have a read-only textbox which will be used to hold a total of
all the numerical values of each checkbox that is checked, and this
value will change dynamically via javascript when a box is ticked or unticked.
e.g.
<script language="javascript">
function GetCost() {
|
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
| |
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
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 we have to send another system
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |