ActionLink generate empty href using MVC 5 with Um

2019-09-09 14:24发布

问题:

I am using MVC 5 with Umbraco 7. Trying to use ActionLink in my View but the markup it generates have empty href. any idea how to get it working?

<a href="">Start Date</a>

View:

@Html.ActionLink(
      "Start Date",
      "SearchV1",
      "SearchV1",
      new { sitetypeid = @Request.QueryString["sitetypeid"], leaNo = @Request.QueryString["leaNo"], orderBy = "VacStart" },
      null)

Controller:

public class SearchV1Controller : RenderMvcController
{
    public override ActionResult Index(RenderModel model)
    {
        return base.Index(model);
    }

    public ActionResult SearchV1(RenderModel model, int sitetypeId , int leaNo, string orderBy = "VacRelDate")
    {
        List<GetJobSearchResults_Result> searchResultsList = Workflow.Vacancy.GetJobSearchResults(sitetypeId , leaNo, "SCH", orderBy, "desc");
        ViewBag.leaNo = leaNo;
        return View(searchResultsList);
    }
}

回答1:

This cannot be possible in Umbraco unless you inherit your controller class from Surface controller.