本文介绍了基于列标题的Listview排序单击的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我正在通过C#代码使用dataadapter绑定listview控件.
我必须基于列标题click来排序listview的值(如果用户单击名称"列,则应该对名称asc/desc进行排序).

我已经设置了CommandName="Sort" CommandArgument="Name" OnClick="Sort_Name_Click"并在以下位置:

 Sort_Name_Click方法
{
  SortDirection Direction1 = SortDirection.Ascending;
  Listview1.Sort(" 名称" ,Direction1);
} 


我收到错误消息未处理的ListView" ListView1"引发事件排序".

请让我知道如何在这里实现排序方法.

谢谢,
Vasanth

解决方案


Hi,

I am binding listview control using dataadapter through C# code.
I have to sort the values of listview based on the column header click(if user clicks on Name column it should sort names asc/desc).

I have already set CommandName="Sort" CommandArgument="Name" OnClick="Sort_Name_Click" and under:

Sort_Name_Click method
{
  SortDirection Direction1 = SortDirection.Ascending;
  Listview1.Sort("Name",Direction1);
}


I am receiving the error message "The ListView ''ListView1'' raised event Sorting which wasn''t handled".

Could you please let me know how do i implement the sorting method here.

Thanks,
Vasanth

解决方案


这篇关于基于列标题的Listview排序单击的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-12 13:24