having some trouble with my razor syntax
gives a Parsor error saying that The foreach block is missing a closing "}" character
<ul>
@{var client = "null";}
@foreach (var instance in Model)
{
if (instance.tbl_Policy.tbl_Client.txt_clientName != client)
{
client = instance.tbl_Policy.tbl_Client.txt_clientName;
</ul><h1>@client</h1>
<ul>
}
<li>
@instance.tbl_Policy.txt_policyNumber -
Assigned to : @instance.aspnet_Membership.aspnet_User.UserName
@instance.ATLCheckType.Question
<button type="button" rel="<%:instance.ATLCheckInstanceId.ToString()%>">DelFiled</button>
<button type="button" rel="<%:instance.ATLCheckInstanceId.ToString()%>">DelLineItem</button>
</li>
}
</ul>
Razor cannot handle imbalanced HTML tags in code blocks.
Change your if
block to treat the imbalanced tags as plain text:
if (instance.tbl_Policy.tbl_Client.txt_clientName != client)
{
client = instance.tbl_Policy.tbl_Client.txt_clientName;
@:</ul><h1>@client</h1>
@:<ul>
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With