سؤال

I want to change this

<a class="more" href="Subject?SubjectId=@Html.DisplayFor(model => item.Id)">Devamı &raquo;</a>

to

<a class="more"@Html.ActionLink("Devamı ", "Subject", new {Subject?SubjectId= item.Id }) ></a>

I can not put &raquo and Subject?SubjectId= to @Html.actionlink. Why?

هل كانت مفيدة؟

المحلول

If you take a look at Microsoft's site, it says Html.ActionLink returns a complete anchor (<a></a>) object based on the parameters you give it.

You can't put the anchor returned by ActionLink into your anchor element. Choose one of the other ways of creating the link.

You may be looking for the Url.Action method, http://msdn.microsoft.com/en-us/library/system.web.mvc.urlhelper.action(v=vs.108).aspx

<a class="more" href=@Url.Action("ControllerName", new {SubjectId = item.Id})
    >Devamı &raquo;
</a>
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top