将ActionLink链接到Controller中的ActionResult

时间:2018-05-23 10:54:01

标签: asp.net asp.net-mvc

我目前正在学习ASP,但我无法将View中的ActionLink链接到Controller中的ActionResult。 这是我的代码:

ViewFiles.cshtml

@Html.ActionLink("Download", "Download", "UploadController")

UploadController.cs

public ActionResult Download()
    {
        return Content("<script language='javascript' type='text/javascript'>alert('Hello world!');</script>");
    }

我现在只是尝试返回警报以查看它是否有效但我收到HTTP 404错误。

1 个答案:

答案 0 :(得分:2)

UploadController 更改为上传let annotationView = MKMarkerAnnotationView(annotation: annotation, reuseIdentifier: identifier) let rightButton = UIButton(type: .detailDisclosure) rightButton.setImage( UIImage(named: "map1"), for: .normal) annotationView.rightCalloutAccessoryView = rightButton

试试这个(在ActionResult上返回JavaScript结果):

@Html.ActionLink("Download", "Download", "Upload")