打你一下

fineui排序问题

后台:

private void BindGrid()
    {

        // 1.获取当前分页数据
        DataSet dataSet = GetPagedDataTable();
        // 2.绑定到Grid
        Grid1.DataSource = dataSet.Table1();
        string sortField = this.Grid1.SortField;
        //string sortDirection = this.;
        BindGridWithSort(sortField, Grid1.SortDirection);
        Grid1.DataBind();
       

    }
    private void BindGridWithSort(string sortField, string sortDirection)

  {
      DataSet dataSet = GetPagedDataTable();

      DataTable table = dataSet.Table1();

 

    DataView view1 = table.DefaultView;

    view1.Sort = String.Format("{0} {1}", sortField, sortDirection);

 

    Grid1.DataSource = view1;

     Grid1.DataBind();

   }

 protected void Grid1_Sort(object sender, FineUI.GridSortEventArgs e)
    {

        this.Grid1.SortDirection = e.SortDirection;
        this.Grid1.SortField = e.SortField;
        this.BindGrid();
    }

前端:

 <f:Grid ID="Grid1" Title="Grid1" PageSize="15" ShowBorder="true" BoxFlex="1" AllowPaging="true" Width="470px" Height="600px"
                AllowSorting="true" OnPageIndexChange="Grid1_PageIndexChange" ShowHeader="false"
                runat="server" EnableCheckBoxSelect="True" DataKeyNames="ID,BrandCode,isshenhe,isshouquan,img,AttchFJ"
                IsDatabasePaging="true" SortField="UserCode" SortDirection="DESC" OnSort="Grid1_Sort"
                OnRowCommand="Grid1_RowCommand">

posted on 2017-08-30 13:38  打你一下  阅读(569)  评论(0编辑  收藏  举报

导航