【发布时间】:2014-04-06 02:45:53
【问题描述】:
我第一次进行分页时效果很好。当我将光标放在页脚分页上时,它看起来像
http://localhostt:62535/Account/Index?page=3
如果我在 WebGrid 上执行任何操作(编辑或删除或可见),则分页 url 将更改为类似
http://localhostt:62535/Account/VisibleCountry?Id=101&page=3
代码
@{
ViewBag.Title = "Index";
Layout = "~/Views/Shared/User.cshtml";
WebGrid grid = new WebGrid(Model.OrderBy(m=>m.idVal), canSort: true, canPage: true, rowsPerPage: 20,
selectionFieldName: "selectedRow", ajaxUpdateContainerId: "stategrid");
}
<div id="countrygrid" align="center">
@grid.GetHtml(tableStyle: "webGrid",
headerStyle: "header",
alternatingRowStyle: "alt",
selectedRowStyle: "select",
columns: new[] {
grid.Column("CountryName","Country Name"),
grid.Column("",header:"Action",format:@<text>
@Html.ActionLink("Edit", "Edit", new { id=item.CountryId })
|
@if (item.deleted == false)
{
<a href="#?id=@item.CountryId" onclick="changeCountry(this)" title="Disable">Disable</a>
}
else
{
<a href="#?id=@item.CountryId" onclick="ChangeCountry(this)" style="color:red" title="Enable">Enable</a>
}
</text>),
grid.Column("",header:"Action",format:@<text><a href="#" id="@item.CountryId" class="countryIdValues" >Addstate</a></text>)
});
</div>
我不明白为什么网址会发生变化。谁能帮我解决这个问题?
【问题讨论】:
标签: jquery asp.net-mvc webgrid