Hello All,
I am having a page in mvc in which I am having a list of checkboxes that I created one by one,now I want to show some of the checkboxes checked if their value is present in the database,Please tell what shall I do.
My code is as follows:
<% if (ViewData["chkLinks"] != null)
{%>
<% foreach (BrandConnectionsPrototype.Models.BC_TabTable Tabs in (List)ViewData["chkLinks"])
{%> " /><%=Tabs.TabName%>
<%foreach (BrandConnectionsPrototype.Models.BC_AddReportStatus report in (List<BrandConnectionsPrototype.Models.BC_AddReportStatus>)ViewData["status"])%>
<%{ %>
<%if (report.TabId == Tabs.TabId)
{ %>
<input type="checkbox" name="ChkTab" value="<%=Tabs.TabId%>" checked ="checked" /><%=Tabs.TabName%><br />
<%} else {%>
<%} %>
<%} %>
<%}%>
<%}%>
this code is repeating the checkboxes.
Please tell what shall I do
Thanks Ritz