开发者

gridview default sortexpression

开发者 https://www.devze.com 2023-01-11 04:51 出处:网络
Has anyone managed to extend a GridView with default sor开发者_开发问答ting? This seems pretty trivial to me but i can\'t get it done.

Has anyone managed to extend a GridView with default sor开发者_开发问答ting? This seems pretty trivial to me but i can't get it done.

The idea is to add a property DefaultSortExpression to a Server Control that inherits GridView.

  • Calling Sort() performs an additional select, we don't want that.
  • Setting this.SelectArguments.SortExpression seems to get it's value set after i do so that doesn't work either. (Unless there's some magical event i didn't try yet).

I want to be able to set the SortExpression before the GridView does it's databinding.


protected override DataSourceSelectArguments CreateDataSourceSelectArguments()
        {
            DataSourceSelectArguments dsa = base.CreateDataSourceSelectArguments();

            // dsa.SortExpression = "my field";

           return dsa;
}
0

精彩评论

暂无评论...
验证码 换一张
取 消