Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / JScript / September 2005

Tip: Looking for answers? Try searching our database.

How to rig a checkboxlist onclick event with jscript?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Roy - 15 Sep 2005 16:21 GMT
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) and javascript:
<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>
<asp:ListItem Value="b">Checked b</asp:listitem>
<asp:ListItem Value="c">Checked c</asp:listitem>
<asp:ListItem Value="d">Checked d</asp:listitem>
<asp:ListItem Value="e">Checked e</asp:listitem>
</asp:CheckBoxList>
</td>
</tr>
<tr>
<td>
<div><b><i>Action notes</i></b></div>
</td>
</tr>
<tr>
<td>
<textarea id="notes" rows="3" cols="25" runat="server"
NAME="notes"></textarea>
</td>
</tr>
</table>

I tried to stick the javascript below into the page_load event, but it's
just not working. :( Any clues? Am I on the right track? Thanks!

CheckBoxList1.Attributes.Add("onclick", "javascript:form1.notes.value =
'this is a test'")
Bruce Barker - 15 Sep 2005 17:07 GMT
yes and no. the checkboxlist, while a single control on the server,
generates individual checkbox controls in the browser. look at the rendered
html to see how this works. the add attribute is proably being applied to he
<span>. you should switch to html controls if you want to use client script.

-- bruce (sqlwork.com)

> The title is self-explanatory, but I'll show you all what I've done thus
> far.
[quoted text clipped - 33 lines]
>
> *** Sent via Developersdex http://www.developersdex.com ***

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.