在ASP.NET中排序不起作用 [英] Sorting in ASP.NET doesn't work

查看:99
本文介绍了在ASP.NET中排序不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试对网格视图进行排序。我也检查了其他帖子,但我的代码因某些原因没有运行。有人可以告诉我这里我做错了什么。任何帮助将不胜感激。谢谢。



我尝试过:



protected void grdCustomers_Sorting (对象发送者,GridViewSortEventArgs e)



{





} < br $>




< asp:GridView ID =gridviewCustomersrunat =serverAllowPaging =falseAllowSorting =TrueCellPadding = 4OnSorting =grdCustomers_SortingDataKeyNames =CustomerIDOnSelectedIndexChanged =grdCustomers_SelectedIndexChanged>

I am trying to sort my grid view. I checked other posts as well but my code does not run for some reason. Can someone please tell me what i am doing wrong here. Any help will be greatly appreciated. Thank you.

What I have tried:

protected void grdCustomers_Sorting(object sender, GridViewSortEventArgs e)

{


}


<asp:GridView ID="gridviewCustomers" runat="server" AllowPaging="false" AllowSorting="True" CellPadding="4" OnSorting="grdCustomers_Sorting" DataKeyNames="CustomerID" OnSelectedIndexChanged="grdCustomers_SelectedIndexChanged">

推荐答案

我无法看到您实际应用排序的位置。 />
如果您的事件处理程序 grdCustomers_Sorting 未触发,请检查GridView是否具有属性
I cannot see where you are actually applying the sort.
If your event handler grdCustomers_Sorting is not firing then check the GridView has the property
AllowSorting=True





如果您的事件处理程序正在触发,那很可能是因为您尚未应用e.SortExpression中的排序。查看文档;

GridView.Sorting事件(System.Web.UI.WebControls) [ ^ ]



亲切的问候



If your event handler is firing then it is likely to be because you have not applied the sort from e.SortExpression. Review the documentation at;
GridView.Sorting Event (System.Web.UI.WebControls)[^]

Kind Regards


这篇关于在ASP.NET中排序不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆