Asp.net mvc 刷新MVC局部视图

Asp.net mvc 刷新MVC局部视图,asp.net-mvc,razor,asp.net-mvc-partialview,Asp.net Mvc,Razor,Asp.net Mvc Partialview,我想每30秒刷新一次局部视图 @{ ViewBag.Title = "Index"; } <h2>Inbox</h2> @Html.Partial("_Inbox") @{ ViewBag.Title=“Index”; } 收件箱 @Html.Partial(“\u收件箱”) 这是我的部分观点 @model IList<Empite.Echo.Repository.Query.SubscriberMessageResult> <table>

我想每30秒刷新一次局部视图

@{
ViewBag.Title = "Index";
}

<h2>Inbox</h2>

@Html.Partial("_Inbox")
@{
ViewBag.Title=“Index”;
}
收件箱
@Html.Partial(“\u收件箱”)
这是我的部分观点

@model IList<Empite.Echo.Repository.Query.SubscriberMessageResult>

<table>
@foreach (var message in Model)
{
<tr>
    <td>@message.Message</td>
    <td>@message.IsRead</td>
    <td>@message.MessageGuid</td>
</tr>
}
</table>
@model-IList
@foreach(模型中的var消息)
{
@留言,留言
@message.IsRead
@message.MessageGuid
}

将您的分部包装在div容器中

@{
ViewBag.Title = "Index";
}

<h2>Inbox</h2>
<div id="partialContainer">
   @Html.Partial("_Inbox")
</div>
然后使用JavaScript刷新

setInterval(function(){
 $('#partialContainer').load('@Url.Action("ActionThatReturnsPartialResult","SomeController")' + '?id=' + id+ '&status=' + status);
}, 30000);
如果要将模型传递给部分控制器,可以使用jQuery方法的数据重载来实现

Loapartial是Div

帐户:财务主任

寄存器是视图和操作

Jquery:

$(document).ready(function(){
             refr();
 });`     

 function refr() {      
    var intervalss = setInterval(refnew, 30000);
    function refnew() {
        $("#Loanpartial").load("/Account/Register");
    }
}

你的问题很简单,很难回答。这里有很多方法,所以在这里列出它们是没有帮助的。你期望什么样的行为?你尝试过什么方法?为什么它们对你不起作用?
$(document).ready(function(){
             refr();
 });`     

 function refr() {      
    var intervalss = setInterval(refnew, 30000);
    function refnew() {
        $("#Loanpartial").load("/Account/Register");
    }
}