How to rig a Checkboxlist Onclick event?

R

Roy

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>
<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'")
 
G

Guest

first off, play with the clientside code, with an all clientside control, and
get that working. After that, THEN, try to add it to the attributes. Its not
really and ASP.Net issue, it's a javascript one I think.
 
R

Roy

Thanks for the reply Curt, but I'm actually beginning to suspect that
one *cannot* generate an onclick event for a checkboxlist
whatsoever...Does anyone have any insight on this?

In this scenario, what would you recommend as an alternative plan?

Thanks
 
G

Guest

Well, I just did this
myCheckBoxList.Attributes.Add("onclick", "alert('test')")

and it works just fine.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,982
Messages
2,570,186
Members
46,739
Latest member
Clint8040

Latest Threads

Top