2010-05-08 76 views
2
<% 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 /> 
<% } %> 

我创造了这个现在的事情,当我点击上的parentid = 0。所有其子任家长应自动点击与parentId的> 0,但不viceversa.How我会做jQuery中? (像我点击某些功能管理用户其子)添加用户,编辑和删除用户应该自动点击),但如果我点击添加用户什么都不应该发生复选框的jQuery

回答

1

不知道你指parentid什么,我把支票对于id> 0,如果这就是你的意思。您可以更改该条件以匹配父ID。

编辑:设置复选框一类“的parentId”的用的parentId> 0,做到以下几点:

$("input:checkbox .parentId").live("click",function(){  
      $(this).children("input:checkbox").attr('checked', $(this).attr('checked'));   
}); 
+0

PARENTID大家从数据库 – maztt 2010-05-08 11:45:27

+0

OK,那你要么不需要这一条件在所有,或者您需要在复选框上设置一个班级并检查该班级。请参阅编辑。 – derek 2010-05-08 12:07:53