* Hello i have long time trying it and i dont get any results, my problem is the next: On my controller i can not get the value of the textbox, but if I put the form and the textbox out of the loop i get the value.*
** this is my view:**
@for (int r = 0; r <= Model.Count-1;r++)
{
i = i + 1;
<tr>
@using (Html.BeginForm("Result","Ruta", new { ruta=Model [r].descrip ,ficha =Model [r].ficha }, FormMethod.Post))
{
if (i == 1)
{
@Html.TextBox("FechaInicio")
}
<td>
@Html.DisplayFor(modelItem => Model[r].ruta)
</td>
<td>
@Html.DisplayFor(modelItem => Model[r].descrip)
</td>
<td>
@Html.DisplayFor(modelItem => Model[r].ficha)
</td>
<td>
<input type="Submit" value="Consultar" style=" height :20px; font-size:12px; "/>
</td>
}
</tr>
My Controller:
[HttpPost]
public ActionResult Result(string ficha, string ruta)
{
Utility.Fecha1 = Request.Form ["FechaInicio"];
if (string.IsNullOrEmpty(ficha) || string.IsNullOrEmpty(ruta) || string .IsNullOrEmpty ( Utility .Fecha1) )
{
return RedirectToAction("FichaConduces", "Ruta", new { ficha = ficha, ruta = ruta,fecha=Utility .Fecha1 });
}
else
{
return View("index");
}
}