Reputation: 12294
<% foreach (var i in (IEnumerable<MvcApplication1.Models.Group>)ViewData["Group"])
{ %>
<input type="checkbox" name="Inhoud" value="<%= i.int_GroupId %>" /> <%= i.vcr_GroupName %><br /><br />(Checkboxes here)
<% foreach (var ik in (IEnumerable<MvcApplication1.Models.Feature>)ViewData["Feature"])
{ %>
<input type="checkbox" name="Inhoud" value="<%= ik.int_FeatureId %>" /> <%= ik.vcr_FeaturesName %><br /> (Checkboxes here)
<% } %>
<br />
<% } %>
I have created this now the thing is that when I click on any parent with parentid=0 .all its child should automatically be clicked with parentid >0 but not viceversa.How would I do it in jquery? (Like i CLICK ON SOME FEATURE Manage User its child Add user ,edit and delete user should be clicked automatically ) but if i click on add user nothing should happened
Upvotes: 2
Views: 103
Reputation: 4886
Not sure what your referring to by parentid, i put a check for the id > 0 if that's what you mean. You can just change that condition to match the parent id.
EDIT: set a class of "parentId" on checkboxes with a parentId > 0 and do the following:
$("input:checkbox .parentId").live("click",function(){
$(this).children("input:checkbox").attr('checked', $(this).attr('checked'));
});
Upvotes: 1