我在我的项目中使用 WebGrid,我已经实现了分页/编辑和删除选项。目前,当我删除和编辑项目时,我将返回第一页。
但是,我想在同一页面返回(返回列表)。你知道我该怎么做吗?
查看代码
<div id="grid">
@{
var grid = Html.Grid(Model, rowsPerPage: 20, defaultSort: "LanguageID");
}
@grid.GetHtml(
tableStyle:"table",
alternatingRowStyle:"alternate",
selectedRowStyle:"selected",
headerStyle:"header",
columns:grid.Columns(
grid.Column(format: (item) => Html.ActionLink("Edit", "Edit", new { localizationID = item.ID, languageID = item.LanguageID })),
grid.Column("Description",header:"Language"),
grid.Column("ParameterName", header:"Parameter name"),
grid.Column("Name",header:"Original (English)", format: item => Html.Raw(item.Name)),
grid.Column("TranslationText",
header:"Translation", format: item => Html.Raw(item.TranslationText))))
</div>
控制器
public ActionResult Index()
{
translations = _translationService.GetByCulture(valueLanguage);
return View(translations);
}
[HttpPost]
public ActionResult Edit(Translation model)
{
if (ModelState.IsValid)
{
_translationService.Update(model);
return RedirectToAction("Index","Translation");
}
retrun View(model);
}
比你。