首先,是否可以将@Html.ActionLink
用于敲除绑定?
如果是,我该怎么写?
这就是我需要的:
@Html.ActionLink( [I want display QuestionID() - a ko view model property] , "Question [controller action name]", "Project [controller name]", new { project = [here should be ProjectID() - a ko view model property] id = [here should be QuestionID() - a ko view model property] }, new Dictionary<string, object> { { "data-bind", "title: 'View detailed question page'" } }))
简单来说,渲染时应该如下所示:
提前致谢。
答案 0 :(得分:1)
您当然可以在ActionLink中包含data-bind
个属性;请看this question and its answers了解如何做到这一点。但请记住,Knockout纯粹是客户端,因此当你想让Knockout与MVC交谈时,你需要提出某种AJAX请求。