I need help to pass a parameter from a view to a controller. The problem I have is that when I send the data back to me a null data and not the one I am sending, it is assumed that through the "href:" I should be able to send the variable to the controller. This is my view:
@model List<Model.Cliente>
@{
ViewBag.title = "Cliente";
}
<h2>Cleintes</h2>
<table class="table table-striped">
<thead>
<tr>
<th style="width:50px;">Id</th>
<th style="width:100px;">RUT</th>
<th>Razsoc</th>
<th style="width:200px;"></th>
</tr>
</thead>
<tbody>
@foreach (var a in Model)
{
<tr>
<td>@a.Id_clien<td>
<td>@a.Rut</td>
<td>@a.Nombre_clien</td>
<td class="text-right">
<a class="btn btn-default btn-success" href="~/Menu/Ver/@a.Rut" title="Visualizar">
<i class="glyphicon glyphicon-eye-open"></i>
</a>
<a class="btn btn-default" href="~/menu/crud/@a.Rut" title="Editar">
<i class="glyphicon glyphicon-pencil"></i>
</a>
</td>
</tr>
}
</tbody>
</table>
And this is my controller:
using Model;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
namespace Sales.Controllers
{
public class MenuController : Controller
{
private Cliente cliente = new Cliente();
public ActionResult Inicio()
{
return View(cliente.Listar());
}
public ActionResult Ver(string rut)
{
return View(cliente.Obtener(rut));
}
}
}