解决方案 »

  1.   

    GridView的EndSorting事件,点击列头查询数据、重新绑定GridControl的数据源。
      

  2.   

    使用自定义排序。
    https://documentation.devexpress.com/#WindowsForms/CustomDocument3071
      

  3.   

    GirdView实现某列显示20条数据自定义排序示例
     <asp:GridView ID="gvKehu" runat="server" AutoGenerateColumns="False" CellPadding="4"
                                                    Font-Size="9pt" ForeColor="#333333" GridLines="None" Width="500px" AllowPaging="True" OnPageIndexChanging="GridView1_PageIndexChanging" OnRowDeleting="GridView1_RowDeleting" OnRowDataBound="gvKehu_RowDataBound">
                                                    <FooterStyle BackColor="#1C5E55" Font-Bold="True" ForeColor="White" />
                                                    <Columns>
                                                        <asp:BoundField HeaderText="客户ID" DataField="BlogID" />
                                                        <asp:BoundField HeaderText="客户姓名" DataField="UserName" />
                                                        <asp:BoundField HeaderText="客户性别" DataField="Sex" />
                                                        <asp:BoundField HeaderText="QQ" DataField="QQ" />
                                                        <asp:BoundField HeaderText="注册时间" DataField="RegTime" />
                                                        <asp:HyperLinkField DataNavigateUrlFields="BlogID" DataNavigateUrlFormatString="BlogInfo.aspx?id={0}"
                                                            HeaderText="详细信息" Text="详细信息" />
                                                        <asp:CommandField HeaderText="删除" ShowDeleteButton="True" />
                                                    </Columns>
                                                    <SelectedRowStyle BackColor="#C5BBAF" ForeColor="#333333" Font-Bold="True" />
                                                    <PagerStyle BackColor="#666666" ForeColor="White" HorizontalAlign="Center" />
                                                    <HeaderStyle BackColor="#1C5E55" Font-Bold="True" ForeColor="White" />
                                                    <AlternatingRowStyle BackColor="White" />
                                                    <RowStyle BackColor="#E3EAEB" />
                                                    <EditRowStyle BackColor="#7C6F57" />
                                                </asp:GridView>
    //加载绑定按时间降序显示前20条数据
    protected void Page_Load(object sender, EventArgs e)
    {
    SqlData da = new SqlData();//创建数据集对象
    this.gvKehu.DataSource = da.ExceDS("select top 20 * from ST_news order by ST_n_date desc");//选择数据表按时间显示前20条数据
    gvKehu.DataKeyNames = new string[] { "BlogID" };//
    gvKehu.DataBind();//绑定控件显示
    }
      

  4.   

    如果是后台绑定的话,点击的时候重新绑定一次试试。我都是用ASPxGridView的。这里的功能更多,更方便。