@html.pagedlistpager post 提交,c# – 将控制值作为html.Pagedlist参数传递

我正在使用分页列表来显示值列表.显示效果很好.我使用提供的Unobtrusive

AJAX来获取其他页面的数据.

这是我的分页控件的外观.

@Html.PagedListPager(Model.CountryList, page => Url.Action("GetCountries", "Dashboard", new {page}), PagedListRenderOptions.EnableUnobtrusiveAjaxReplacing(PagedListRenderOptions.ClassicPlusFirstAndLast, new AjaxOptions()

{

HttpMethod = "POST",

UpdateTargetId = "panel1",

OnSuccess = "onAjaxSuccess",

OnFailure = "onAjaxFailure"

}))

这很好用.

现在我在页面中有一个文本框和一个下拉框,我想传递那些与Html分页列表一起出现的值.

@Html.TextBox("SearchCountryName", new { name = "SearchCountryName", @class = "form-control", placeholder = "Search Country" })

@Html.DropdownList("Continent", ContinentList)

我的控制器代码是:

public PartialViewResult GetDashboardBody(string country,string continent,int? page)

{

}

我想做点什么

@Html.PagedListPager(Model.CountryList, page => Url.Action("GetCountries", "Dashboard", new {country = $("#SearchCountryName").val(),continent = $("#Continent").val(),page}), PagedListRenderOptions.EnableUnobtrusiveAjaxReplacing(PagedListRenderOptions.ClassicPlusFirstAndLast, new AjaxOptions()

{

HttpMethod = "POST",

UpdateTargetId = "panel1",

OnSuccess = "onAjaxSuccess",

OnFailure = "onAjaxFailure"

}))

但这不起作用.

那么如何使用html.PagedList将控件的当前值作为参数传递给action方法呢?

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值