Wrox Home  
Search P2P Archive for: Go

  Return to Index  

asp_discuss thread: Re: Dynamic Check Box - Check All


Message #1 by anoop.a.koshy@v... on Tue, 21 Aug 2001 21:07:36
<input type="checkbox" name="A<%=i%>" value="CHECKED">



CHECKED is the word, default is off.



Anoop



> I'm newcomer in ASP technology.

> Can anybody help me on how to Check All the Check Box that i created

> dynamically using asp by one click on the same page(client-side 

scripting).

> 

> for example :

> <%

> n=100

> for i = 1 to n

> %>

> <input type="checkbox" name="A<%=i%>" value="Approve">

> <%

> next

> %>

> 

> thks.

> 

> hk
Message #2 by Anurag Garg <garg_anurag_78@y...> on Tue, 21 Aug 2001 21:49:59 -0700 (PDT)
--- anoop.a.koshy@v... wrote:

> <input type="checkbox" name="A<%=i%>"

> value="CHECKED">

> 

> CHECKED is the word, default is off.

> 

> Anoop

> 

> > I'm newcomer in ASP technology.

> > Can anybody help me on how to Check All the Check

> Box that i created

> > dynamically using asp by one click on the same

> page(client-side 

> scripting).

> > 

> > for example :

> > <%

> > n=100

> > for i = 1 to n

> > %>

> > <input type="checkbox" name="A<%=i%>"

> value="Approve">

> > <%

> > next

> > %>

> > 

> > thks.

> > 

> > hk

> ---







you can try out the following code by writing it into

a procedure that is called on the onclick event of the

button:



dim item

for each item in form1

    if item.type=checkbox then

        item.checked=true

    end if

next





Message #3 by "Bisht" <bisht@m...> on Fri, 24 Aug 2001 11:15:08 +0530
ok..



User variable to check your dynamic checkboxes like below:



<% for i=1 to 10 %>



    <!--- i variable will take care of your checkbox name dynamically like

1,2,3,4,5,6,7,8,9,10 or you can give like 'A<%=i%>' then your checkbox name

will be "A1,A2,A3,A4,A5,A6,A7,A8,A9,A10" -->



    <input type="checkbox" value="xyz" name="<%=i%>" checked>



<% next %>



Thanks...



----- Original Message -----

From: <anoop.a.koshy@v...>

To: "asp_discuss" <asp_discuss@p...>

Sent: Tuesday, August 21, 2001 9:07 PM

Subject: [asp_discuss] Re: Dynamic Check Box - Check All





> <input type="checkbox" name="A<%=i%>" value="CHECKED">

>

> CHECKED is the word, default is off.

>

> Anoop

>

> > I'm newcomer in ASP technology.

> > Can anybody help me on how to Check All the Check Box that i created

> > dynamically using asp by one click on the same page(client-side

> scripting).

> >

> > for example :

> > <%

> > n=100

> > for i = 1 to n

> > %>

> > <input type="checkbox" name="A<%=i%>" value="Approve">

> > <%

> > next

> > %>

> >

> > thks.

> >

> > hk
Message #4 by "Hema R." <hema.r@s...> on Fri, 24 Aug 2001 10:06:09 +0530
Hi,



It is not necessary to assign name uniquely.You can give all the checkboxes

the same name.

You can access it as a collection on the page.

For eg:

In the loop you can have

	<%

		n=100

		for i = 1 to n

	%>

		<input type="checkbox" name="chk" value="Approve">

	<%

		next

	%>

	The value can be the dynamic value from db.

	Also through javascript you can access the collection of checkboxes

like this



	for(i=0;i<document.frm.elements["cb1"].length;i++)

		document.frm.elements[i].checked	(This gives whether

the cb is checked or this value can be assigned)

		document.frm.elements[i].value		(This gives the

value of the cb if assigned dynamically)



following is the script for checking all the cb's

	for(i=0;i<document.frm.elements["cb1"].length;i++)

		document.frm.elements[i].checked=true



regards

Hema



> -----Original Message-----

> From:	anoop.a.koshy@v... [SMTP:anoop.a.koshy@v...]

> Sent:	21 August Tuesday 2001 02:08 PM

> To:	asp_discuss

> Subject:	[asp_discuss] Re: Dynamic Check Box - Check All

> 

> <input type="checkbox" name="A<%=i%>" value="CHECKED">

> 

> CHECKED is the word, default is off.

> 

> Anoop

> 

> > I'm newcomer in ASP technology.

> > Can anybody help me on how to Check All the Check Box that i created

> > dynamically using asp by one click on the same page(client-side 

> scripting).

> > 

> > for example :

> > <%

> > n=100

> > for i = 1 to n

> > %>

> > <input type="checkbox" name="A<%=i%>" value="Approve">

> > <%

> > next

> > %>

> > 

> > thks.

> > 

> > hk

  Return to Index