宁静模板部分视图未呈现数据

时间:2019-05-24 09:37:52

标签: c# model-view-controller

我正在使用宁静模板并在右侧导航面板(div)上显示我的通知队列。出于PUC的目的,我正在将虚拟数据从控制器发送到局部视图(我从Postman击中控制器动作,并接受要在局部视图中反映的数据)

这是我的代码

部分视图

-RightNavigation.cshtml-

@model ESignature.Model.Notifications

<input type="text">@Model.Message</input>

======================================

ControllerActionMathod

[HttpPost, AllowAnonymous]     
    public ActionResult CallPost()
    {
       Notifications notification = new Notifications();
       notification.Message = "And i am iron man!!";                    
       return PartialView(MVC.Views.Shared.RightNavigation, notification);
    }

======================================

当我调试时,我收到了变量中的数据,但没有反映在UI上

1 个答案:

答案 0 :(得分:0)

尝试

@model ESignature.Model.Notifications

<input type="text" value="@Model.Message"/>

和控制器动作

 [HttpPost, AllowAnonymous]
    public ActionResult CallPost()
    {
        Notifications notification = new Notifications();
        notification.Message = "And i am iron man!!";
        return PartialView("RightNavigation", notification);
    }