I need to do a loop in another loop and I get a strange error as if it lacked a closing } and I get a compile error on the page. As against the project compiles . the error message is
CS1513 : } expected.
The source indicates the line of code in 1238 while I was not more than 150 lines of code in the page, really strange . help please
@using (Html.BeginForm("VCreateCommande", "CCommande", new { id = "formretouche" }, FormMethod.Post, new { enctype = "multipart/form-data" }))
{
@Html.AntiForgeryToken()
<hr />
@Html.ValidationSummary(true, "", new { @class = "text-danger" })
<div class="form-group">
<div class="control-label col-md-2">Support papier</div>
<div class="col-md-10">
@Html.CheckBoxFor(model => model.Tretouche.Supportpapier, new { htmlAttributes = new { @class = "form-control" } })
@Html.ValidationMessageFor(model => model.Tretouche.Supportpapier, "", new { @class = "text-danger" })
</div>
</div>
var i = 1;
foreach (var item in Model.Tformats)
{
var idformat = "idformat" + i;
var idquantite = "qteformat" + i;
var idtxt="qte" + @item.Idformat;
int qteretoucheformat=0;
foreach (var itemretoucheformat in Model.Tretouchesformats)
{
if(itemretoucheformat.IdFormat ==item.Idformat)
{
qteretoucheformat = itemretoucheformat.Quantité;
}
}
<div>
<div class="form-group">
<div class="control-label col-md-2 fltleft">Quantité @item.Format</div>
<div class="col-md-10 fltleft">
@Html.TextBoxFor(model => model.Tretoucheformat.Quantité, new { id = idtxt, Name=idtxt })
@Html.ValidationMessageFor(model => model.Tretoucheformat.Quantité, "", new { @class = "text-danger" })
</div>
</div>
</div>
i = i + 1;
}
<div class="form-group">
<div class="control-label col-md-2">Photo...</div>
<div class="col-md-10">
@Html.TextBoxFor(model => model.Tretouche.fichierphoto, new { type = "file" })
</div>
</div>
<input id="idtyperetouche" name="idtyperetouche" type="text" value="@idtyperetouche" class="hdn" />
<input name="idcommande" type="text" value="@idtyperetouche" class="hdn" />
<div class="form-group">
<div class="col-md-offset-2 col-md-10">
<input type="submit" value="Ajouter" class="btn btn-default" />
</div>
</div>
}
<table class="table">
<tr>
<th>Papier</th>
<th>Quantite</th>
<th>Type de retouche</th>
<th>Photo</th>
</tr>
@foreach (var item in Model.Tretouches)
{
var prix = 0;
<tr>
<td>
@Html.CheckBox("Papier", item.Supportpapier)
</td>
<td>
@Html.DisplayFor(modelItem => item.Quantite)
</td>
@foreach (var typeretouche in Model.Ttyperetouches)
{
if (item.Idtyperetouche == typeretouche.Idtyperetouche)
{
<td>@typeretouche.Libelle</td>
prix = (typeretouche.Prix * item.Quantite);
}
}
<td>
<img src="@item.SRCphoto" class="">
</td>
<td>
@prix €
</td>
<td>
@Html.ActionLink("Modifier", "Edit", "TRetouches", new { id = item.Idretouche }, null) |
@Html.ActionLink("Supprimer", "Delete", "TRetouches", new { id = item.Idretouche }, null)
</td>
</tr>
}
Aucun commentaire:
Enregistrer un commentaire