这是我要更新的地方:
<div style="text-align: center;" id="vote_count">@Html.DisplayFor(q => q.VoteCount)</div>
这是我的actionLink:
@Ajax.ActionLink("Upvote", "Upvote", "Author", new { QuestionID = Model.QuestionID, @class = "upvote" },
new AjaxOptions
{
InsertionMode = InsertionMode.Replace,
UpdateTargetId = "vote_count",
OnBegin = "onBegin",
OnComplete = "onComplete",
OnSuccess = "onSuccess",
OnFailure = "onFailure"
})
这是我的控制器之一:
public int Upvote(Guid QuestionID)
{
if ()
{
//I want to send error message
}
else
{
//I want to send an integer
}
}
我的问题是:我想向我的视图页面发送错误消息或整数来显示它。我该怎么做?根据您推荐的建议,我可以更改所有代码。
谢谢。