문제

inside my mvc razor view I'm getting list of objects and inside foreach loop I'm creating links like

@{ 
    var dday = @ViewBag.Day;     
}
@foreach (var a in Model)
{
   <li>
        @Html.ActionLink(a.Name, "ProcessAction", "Home", new { ss= @a.Id, dd= dday, cc= @a.Comp}, null)            
   </li>
}

on controller side I'm getting first two variables populated and third parameter as null even @a.Comp is populated in the moment of sending inside link.

On link mouse over I'm getting third argument as Domain.Comp

도움이 되었습니까?

해결책

You cannot transfer arbitrary objects as URL parameters. Restrict yourself to strings and numbers, dates can already be tricky.

In your case it looks like you should use: cc= @a.Comp.Id.

You should be able to retrieve the object serverside from its Id.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top