if (Request.QueryString["action"] == "desc")
{
this.ObjectDataSource1.SelectMethod = "SelectAll";
ObjectDataSource1.TypeName = "productManager";
ObjectDataSource1.SelectParameters.Add("top",TypeCode.Int32, "-1");
}
if (Request.QueryString["action"] == "asc")
{
this.ObjectDataSource1.SelectMethod = "SelectAll";
ObjectDataSource1.TypeName = "productManager";
}
ObjectDataSource1.Select();
ObjectDataSource1.DataBind();
这是我排序的代码,代码没有问题,但是排序后如何保持其状态?
也就是说后天排序后,前台怎么沿用后台的顺序,我的思路是,每一次排序就改变数据库一状态值,然后根据状态值绑定查询方法,但这样做笨了点,我用的GridView的数据源来做的,前台用Repeater,请问有没有更好的方法来搞定这个问题,请尽量优雅
{
this.ObjectDataSource1.SelectMethod = "SelectAll";
ObjectDataSource1.TypeName = "productManager";
ObjectDataSource1.SelectParameters.Add("top",TypeCode.Int32, "-1");
}
if (Request.QueryString["action"] == "asc")
{
this.ObjectDataSource1.SelectMethod = "SelectAll";
ObjectDataSource1.TypeName = "productManager";
}
ObjectDataSource1.Select();
ObjectDataSource1.DataBind();
这是我排序的代码,代码没有问题,但是排序后如何保持其状态?
也就是说后天排序后,前台怎么沿用后台的顺序,我的思路是,每一次排序就改变数据库一状态值,然后根据状态值绑定查询方法,但这样做笨了点,我用的GridView的数据源来做的,前台用Repeater,请问有没有更好的方法来搞定这个问题,请尽量优雅
则设置ObjectDataSource1的参数即可,如:
ObjectDataSource1.SelectParameters["myOrder"].DefaultValue="Desc"; //或者Asc