asp.nethtml.actionlink

html.actionlink? to view list of users


<%:Html.Actionlink(Model.User.Count().ToString, " " )

The code sets a actionlink on count. But when i click on the count it should show the list of users.

for ex:

if the count is 5

a click on 5 should dsiplay those 5 users on the list how set up the argument?


Solution

  • Make sure the text of the link is a string when you pass it into ActionLink. Maybe it was a typo but Actionlink (lowercase L) is not an extension method on HtmlHelper.

    <%:Html.ActionLink(Model.User.Count().ToString(), "Details") %>
    

    LinkExtensions.ActionLink Method (HtmlHelper, String, String)

    public static MvcHtmlString ActionLink(
        this HtmlHelper htmlHelper,
        string linkText,
        string actionName
    )