I have my following controller:
public ActionResult Index2(int Id= 0)
{
if (Id == 0)
{
return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
}
ViewBag.ClienteId = Id;
return View();
}
public ActionResult Index3(int Id= 0)
{
if (Id == 0)
{
return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
}
ViewBag.ClienteId = Id;
return View();
}
and others
In all of them, I have a partial with the following code:
@Html.Partial("_MenuInfo")
And in it I have my menu with the Customer Id as I go through the ViewBags
<div class="col-md-12">
<div class="row">
<ul class="nav nav-tabs" role="tablist">
<li class="active"><a href='@Url.Action("Novo", "Grupo", new { area = "Cadastro" })/@ViewBag.ClienteId' class="btn btn-success">Grupo</a></li>
<li><a href='@Url.Action("Novo", "Acesso", new { area = "Cadastro" })/@ViewBag.ClienteId' class="btn btn-success">Acesso</a></li>
</ul>
</div>
</div>
But it happens that as I browse the links
He is rendering the following link
Group / New / 17/17
That is, you are generating 2x the Client code that comes from the ViewBag
I need this menu to be in several Views, so that when I give a "New" I already send the Client Id that is an FK in the table