Adding client JS to a CheckBoxList item

Results 1 to 2 of 2

Thread: Adding client JS to a CheckBoxList item

  1. #1
    Join Date
    Dec 1969

    Default Adding client JS to a CheckBoxList item

    arrg, this is driving me crazy....<BR><BR>I have "CheckRoles" defined as a CheckBoxList control, and i&#039;d like to add some client side script to jazz up the interface a bit.... but neither of these generate one single iota of html inside the resultant "&#060;input type="checkbox"....&#062;" tag<BR><BR>any ideas/suggestions? i have already tried:<BR><BR>For i = 0 To CheckRoles.Items.Count - 1<BR> CheckRoles.Items(i).Attributes.Add("onClick", "alert(&#039;Clicked!&#039;)")<BR> CheckRoles.Items(i).Attributes.Add("onChange", "alert(&#039;Changed!&#039;)")<BR>Next<BR><BR>obvi ously thats not what i want to ultimately do, but i am trying somewhere!

  2. #2

    Default RE: Adding client JS to a CheckBoxList item

    It might end up being similar.<BR>Try with an "invalid" attribute name like <BR>CheckRoles.Items(i).Attributes.Add("MonkeyMonk ey", "alert(&#039;Clicked!&#039;)")<BR><BR>I had problems using the "value" attribute so I use "serverValue". Using "value" would produce nothing in the html.<BR><BR>At the limit,you might need to build a control that inherits from CheckBoxList and override some members related to adding attributes (AddAttributesToRender).<BR><BR>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts