Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Web Controls > How can I add javascript client code while developing ASP.NET controls inside VS2005?

Reply
Thread Tools

How can I add javascript client code while developing ASP.NET controls inside VS2005?

 
 
Savvoulidis Iordanis
Guest
Posts: n/a
 
      01-31-2007
I want to create a checkbox that when clicked, selects/deselects all items
in a list box, on the client side (no round trip)
What kind of code should I add (and where in the asp.net web control) ?


 
Reply With Quote
 
 
 
 
Thomas Hansen
Guest
Posts: n/a
 
      02-01-2007
On Jan 31, 3:48 pm, "Savvoulidis Iordanis" <(E-Mail Removed)>
wrote:
> I want to create a checkbox that when clicked, selects/deselects all items
> in a list box, on the client side (no round trip)
> What kind of code should I add (and where in the asp.net web control) ?


First of all EVERYBODY that is SERIOUS about JavaScript should deeply
consider prototype.js
(Google for it)
Now assuming you have prototype.js file included in your page:

var x = $('idOfMyCheckBox'); // often in "RenderContent" of your
WebControl "string.Format("$('{0}');", ClientID)

Element.observe(x, 'click', function(){
$A(myListBoxElement.childNodes).each(function(idx) {
idx.selected = true;
});
});


And off you go!
To do this WITHOUT prototype.js would mean you're writing 10-20 times
as many lines of code if you are serious about being browser
compatible...

..t

--
http://ajaxwidgets.com
Free ASP.NET Ajax Widgets NOW!

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: How include a large array? Edward A. Falk C Programming 1 04-04-2013 08:07 PM
Whats with Cisco developing a Client for the iPhone before it has aWindows Client? scooter133@gmail.com Cisco 0 07-16-2008 05:38 PM
this.Controls.Add(Control) Does Not Add Control to child collection (this.Controls.Count == 0) Chad Scharf ASP .Net 3 10-18-2007 03:53 PM
How can I add HTML inside a Javascript function? VictorG Javascript 10 06-26-2005 05:23 AM
Re: Can We Use EXEC CGI Inside a JavaScript Applet Inside an HTML File? David Dorward HTML 1 06-28-2003 09:30 AM



Advertisments