I used inside the foreach condition where statement so i cannot able to take checked value count. so how can i get the checked value count?
<ul id="tree" class="dd-list">
@foreach (var domain in Model.DomainViews)
{
<li class="dd-item">
<a>
@Html.CheckBoxFor(model => domain.IsChecked, new { @id = domain.DomainID, name = "DomainViews" })
<label for="@domain.DomainID">@domain.DomainName</label>
@Html.HiddenFor(model => domain.DomainID, new { id = "hdnDomainID" })
</a>
<ul class="dd-list">
@foreach (var module in @Model.ModuleViews.Where(x => x.DomainID == domain.DomainID))
{
<li class="dd-item">
<a>
@Html.CheckBoxFor(model => module.IsChecked, new { @id = module.ModuleID, name = "ModuleViews" })
<label for="@module.ModuleID"> @module.ModuleName</label>
</a>
<ul class="dd-list">
@foreach (var child in @Model.ChildModuleViews.Where(x => x.ParentModuleID == module.ModuleID))
{
<li class="dd-item">
<a>
@Html.CheckBoxFor(model => child.IsChecked, new { @id = child.ModuleID, name = "ChildModuleViews" })
<label for="@child.ModuleID"> @child.ModuleName</label>
</a>
</li>
}
</ul>
</li>
}
</ul>
</li>
}
</ul>
I know to take count from for loop statement. but i don't know how use where condition in for statement.