Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 1.0 and 1.1 > ASP.NET 1.0 and 1.1 Basics
|
ASP.NET 1.0 and 1.1 Basics ASP.NET discussion for users new to coding in ASP.NET 1.0 or 1.1. NOT for the older "classic" ASP 3 or the newer ASP.NET 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 1.0 and 1.1 Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old July 6th, 2006, 08:43 PM
avilren
Guest
 
Posts: n/a
Default Check all Checkboxlist items on client-side

Please help me guys..

I have a checkboxlist which items are taken from the database.
I have also two buttons, one is to check all the items and the other is to uncheck it.
Also, there is a datagrid which items are loaded during page_load.

Now, every time I click either of the two buttons, yes, it will check or uncheck all the items, but the items of the datagrid becomes empty.
I have read some articles that maybe it's because of the postback thing. So instead of doing it server-side, I was advised to do it on the client-side.

My problem now is how can I uncheck or check all items in client-side?

Please help me.
I badly need it. Thanks a lot.
 
Old July 7th, 2006, 08:13 AM
Authorized User
 
Join Date: Jun 2006
Posts: 15
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Client side is nothing but a javascript script. You need to write a javascript for this so that there wont be any post back.

Here is the sample code but you need to modify this according to your needs.

<html>
<head>
<script type="text/javascript">
function check()
{
document.getElementById("myCheck").checked=true
}

function uncheck()
{
document.getElementById("myCheck").checked=false
}
</script>
</head>

<body>
<form>
<input type="checkbox" id="myCheck" />
<input type="button" onclick="check()" value="Check Checkbox" />
<input type="button" onclick="uncheck()" value="Uncheck Checkbox" />
</form>
</body>

</html>
Hope this might help you out.

 
Old July 9th, 2006, 10:40 AM
avilren
Guest
 
Posts: n/a
Default

Thanks vitthala.

I forgot to mention, but I am referring to a checkboxlist server control.






Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem Converting Client-side to Server-side Code kwilliams ASP.NET 2.0 Professional 1 November 21st, 2007 05:25 PM
check n uncheck items in checkboxlist in datalist moorejkrkumar ASP.NET 1.0 and 1.1 Basics 1 April 17th, 2007 01:39 PM
How to check installables in client side agnihotrived ASP.NET 2.0 Professional 1 November 8th, 2005 02:41 AM
Firing server side events at client side codes mehdi62b ASP.NET 1.0 and 1.1 Basics 6 May 18th, 2005 09:11 AM
Check Existance of file at Client Side hrishimusale Classic ASP Basics 2 September 9th, 2003 03:50 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.