<itemtemplate> <asp:checkbox1 runat="server" id="checkbox1" > <asp:checkbox1ist runat="server" id="cbCollectFor" > </itemtemplate>
$("[id*=chkOption1]").on("click", function () { $.ajax({ type: "POST", url: "AdminInitiateCollection.aspx/GetCollectionAreas", data: '{}', contentType: "application/json; charset=utf-8", dataType: "json", success: OnSuccess, failure: function (response) { //alert(response.d); } }); }); function OnSuccess(response) { var chkOption1 = $(this); var grid = $(this).closest("table"); var dtcollection = response.d; // Here my output is [ hard disk, hello, collection ] var ddCollection = dtcollection.split(","); var $ctrls = $("#<%=gvInitiateCollection.ClientID%> tr input[id*='cbCollectFor']"); alert($ctrls); for (var i = 0; i < ddCollection.length; i++) { var isChecked = $("#<%=gvInitiateCollection.ClientID%> tr input[id*='chkOption1']").is(":checked"); if (isChecked) { $ctrls.find('label:contains("' + ddCollection[i] + '")').prev().prop('checked', true); } else { $(this).removeAttr("checked"); $("td", $(this).closest("tr")).removeClass("selected"); $ctrls.find('label:contains("' + ddCollection[i] + '")').prev().prop('checked', false); } } //}); }
var $ctrls = $("#<%=gvInitiateCollection.ClientID%> tr input[id*='cbCollectFor']"); alert($ctrls);
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)