小编Cin*_*eno的帖子

将默认排序箭头添加到GridView

我是Asp.net的新手,我目前正在使用GridViews.我浏览了这个网站,其他人已经看到了如何向列标题添加排序箭头的提示.

到目前为止我已经这样做了:

设置这些GridView属性:

SortedAscendingHeaderStyle-CssClass="sortasc"
SortedDescendingHeaderStyle-CssClass="sortdesc"
Run Code Online (Sandbox Code Playgroud)

我的CSS有这个:

th.sortasc a  
{
   display:block; padding:0 4px 0 15px; 
   background:url("images/icons/ascArrow.png") no-repeat;
}

th.sortdesc a 
{
   display:block; padding:0 4px 0 15px; 
  background:url("images/icons/descArrow.png") no-repeat;
}
Run Code Online (Sandbox Code Playgroud)

这非常适合在用户单击标题并对列进行排序后显示图像.

我现在遇到的问题是,我希望列默认显示图像,以便用户可以知道他们可以点击它们进行排序.有没有办法实现这个目标?

asp.net gridview

5
推荐指数
1
解决办法
2万
查看次数

标签 统计

asp.net ×1

gridview ×1