【发布时间】:2011-11-09 06:07:24
【问题描述】:
我创建了一个局部视图,在其中我使用 AJAx.BeginForm。在 Post Edit Action Method 中,我像这样添加 VIEWDATA
if (ModelState.IsValid)
{
service.SaveAccount(account);
TempData["message"] = "Account has been updated successfully!";
AccountInfo accountInfo = new AccountInfo();
accountInfo.AccountStatuses = service.GetAccountStatuses();
accountInfo.AccountTypes = service.GetAccountTypes();
accountInfo.CreditTerms = service.GetCreditTerms();
return View("DisputeSubscriber", accountInfo);
}
else
{
return PartialView("_UpdateAccountDetails", account);
}
并重定向到相同的局部视图。在部分视图中,我添加了这样的内容:
@if (TempData["message"] != null)
{
<div class="Message">
I am here.
@TempData["message"]
</div>
}
但此消息未显示。此消息也在 AJAX.BeginForm 中。请推荐
我需要重定向主视图而不是部分视图还是我缺少某些东西
【问题讨论】:
标签: asp.net-mvc asp.net-mvc-3 razor