I have the following code:
@{
var index=0;
}
@foreach (AdminSummary adminSummary in @Model.AdminSummaries) {
index++;
<div class="rep_tr0">
<div class="rep_td0">@adminSummary.RowKey</div>
<div class="rep_td0"><a href="/Administration/Products/Edit?&ac=@Model.Meta.AccountID&pr=@Model.Meta.ProductID&pa=@Model.Meta.PackageID&co=@adminSummary.RowKey">Edit</a></div>
<div class="rep_td0"><a href="/Administration/Products/Delete?&ac=@Model.Meta.AccountID&pr=@Model.Meta.ProductID&pa=@Model.Meta.PackageID&co=@adminSummary.RowKey">Delete</a></div>
<div class="rep_td0">@Html.TextBox("position_" index, @adminSummary.Position, new { size = 5 })</div>
<div class="rep_td0">@adminSummary.Title</div>
<div class="rep_td0">@adminSummary.DetailCount</div>
<div class="rep_td0">@adminSummary.Modified</div>
<div class="rep_td0">@adminSummary.ModifiedBy</div>
</div>
}
I am trying to find a good way to add an index value to the position name.
But this keeps giving me the error: CS1026: ) expected for the line with position_ on
Does anyone have any idea what I might be doing wrong?
Update:
I tried the following:
<div class="rep_td0">@Html.TextBox("position_"@(index), @adminSummary.Position, new { size = 5 })</div>
This gave the error: CS1646: Keyword, identifier, or string expected after verbatim specifier: @
Try