I am trying to display some rows in a table. Depending on the UserGroup, the View should show different markup. An administrator can delete rows, but a moderator can only ma
The title has parse error because you did not set a title:
@{
ViewBag.Title = "Home Page";
}
now for an else statement, don't use back the @ syntax:
@if(visible)
{
Html.TextBoxFor(bs => Model.Row_Description, new { @class = "rowdesc", size = 45 })
}
else
{
Html.TextBoxFor(bs => Model.Row_Description, new { @class = "rowdesc", size = 45, disabled = "disabled" })
}
You are checking for a boolean, you just need an else. Also for else if, it works the same.
Your code could be simplified even more by just doing:
@Html.TextBoxFor(bs => Model.Row_Description, new { @class = "rowdesc", size = 45, disabled = visible ? "" : "disabled" })
Because you are displaying the same code anyways, just changing the attribute based on a value. To me, this becomes more readable.