Handle onClick of Asp:CheckBoxList ONLY if Checked in Jquery

gammaraptorr

New Member
I have a asp.net checkboxlist that is dynamically generated and I need to process some code if the checkbox was initially checked and is unchecked. This needs to be done in Jquery or Javascript. All the examples I see deal with getting all values of "Checked" I am only interested in getting the specific item that triggered the onClick() event's ID so that I can run some other code to process it.\[code\] public void DrawPoolWeekCbList() { var poolWeeks = ControllerFacade.GetAllPoolWeeksByPoolYear(PageView.PoolWeekYear.Text); var pWeekCount = poolWeeks.Count; var curRecord = 0; foreach (var poolWeek in poolWeeks) { PageView.cblPoolWeeks.Items.Add(poolWeek); PageView.cblPoolWeeks.Items[curRecord].Attributes.Add("onclick", "OnCheckBoxClicked("+ poolWeek +")"); curRecord++; } }//UI Code function OnCheckBoxClicked(poolWeek) { var chkId = poolWeek.toString(); $('#<%= lblPoolWeekChange.ClientID %>').text(chkId); $(".addNew").dialog("open"); }\[/code\]All the samples I have seen find ALL checked checkboxes and loop through them all, again I just want the SPECIFIC chechboxes id that triggered the function.Thanks!
 
Back
Top