0
をクリックして私の見解である:MVCパスINTここ
@foreach (var item in Model)
{
if(i == 0)
{
@:<div class="row">
}
<div class="col-md-3 col-xs-12" style="margin-top:20px;">
@Html.ActionLink(item.Name, "ClientDetail", "Client", null, new { @class = "btn btn-primary btn-block", id = @item.id})
</div>
i++;
if(i%4 == 0)
{
@:</div>
i = 0;
}
}
、ここでは、コントローラです:
public ActionResult ClientDetail(int id)
{
ClientModel model = cserv.Get(id, User.Identity.GetUserId());
ClientViewModel viewModel = new ClientViewModel(model);
return View(viewModel);
}
私は私のリンクをクリックするたびに、それが与えます私のこのエラー:
The parameters dictionary contains a null entry for parameter 'id' of non-nullable type 'System.Int32' for method 'System.Web.Mvc.ActionResult ClientDetail(Int32)' in 'TechUCRM.Controllers.ClientController'. An optional parameter must be a reference type, a nullable type, or be declared as an optional parameter.
Parameter name: parameters
私のidパラメータがコントローラに渡されないのはなぜですか?
ありがとうございました!
チャームのように働いた。ありがとうございました! –