asp.net 怎么把前台传来的值(所有request["xxx"]的值)再当作参数传给另一个函数?
现在有这样一个需求,前台用了一个插件,在好几个页面中都使用,所以我想把这个插件向后台传的参数直接封装成一个方法,但是封装成方法后前台的值就传不到函数里去了,看代码:
封装的函数:
public class TableCondation : BaseController
{
public int PageIndex;
public int PageSize;
public int OrderColumn;
public string Order;
public string OrderBy;
public string SearchGlobal;
public void setValus(HttpRequestBase request)
{
PageIndex = request["start"] != null ? int.Parse(Request["start"]) + 1 : 1;
PageSize = request["length"] != null ? int.Parse(Request["length"]) + int.Parse(Request["start"]) : 10;
OrderColumn = int.Parse(request["order[0][column]"]);
...
}
另一个页面的后台:
TableCondation dtcon=new TableCondation();
dtcon.setValus(Request);
int PageIndex = dtcon.PageIndex,
运行起来后显示 :“未将对象引用设置到对象的实例”
断点看到request里没有传过去的值。所以问一下怎么才能把前台传来的值封装一下当作参数传出去