zoukankan
html css js c++ java
asp.net点击表头增加排序标示
首先点击gridview的表头要有排序的功能才行,关于这个我的另一篇文章里有介绍
注意要把gridview表头的HtmlEncode的值改成false
/**/
///
<summary>
///
为GridView.HeaderRow添加排序标识符
///
</summary>
///
<param name="headerRow">
GridViewRow
</param>
private
void
changeHeaders(GridViewRow headerRow)
{
if
(
this
.GridViewFileList.Rows.Count
>
0
) //有数据时才执行
{
for
(
int
i
=
0
; i
<
headerRow.Cells.Count; i
++
)
{
if
(headerRow.Cells[i]
is
DataControlFieldCell)
{
DataControlField field
=
((DataControlFieldCell)headerRow.Cells[i]).ContainingField;
if
(field.HeaderText.IndexOf(
"
↓
"
)
>=
0
||
field.HeaderText.IndexOf(
"
↑
"
)
>=
0
)
field.HeaderText
=
field.HeaderText.Substring(
0
, field.HeaderText.Length
-
"
<font color='#FF0000'>↓
</
font
>
"
.Length); //把开始的排序方式去掉
if
(
this
.HiddenFieldGridViewSortExpression.Value
!=
""
&&
this
.HiddenFieldGridViewSortExpression.Value.Trim().Equals(field.SortExpression.Trim()))
{
//保存了排序方式的隐藏控件
if
(
this
.HiddenFieldGridViewSortDirection.Value.Equals(
"
DESC
"
))
//
增加新的排序方式
field.HeaderText
=
field.HeaderText
+
"
<font color='#FF0000'>↓</font>
"
;
else
field.HeaderText
=
field.HeaderText
+
"
<font color='#FF0000'>↑</font>
"
;
}
}
}
}
}
查看全文
相关阅读:
Eclipse背景颜色设置
SQL ROW_NUMBER() OVER函数的基本用法用法
hdu 2844 Coins 多重背包问题
VC++学习/MFC (1)
java学习 (1)
hdu 1506 City Game 二维的多重背包
java学习(2)
VC++学习/MFC (2)
hdu 1506 Largest Rectangle in a Histogram
hdu 1171 Big Event in HDU
原文地址:https://www.cnblogs.com/ringwang/p/1244346.html
最新文章
Linux下如何查看tomcat是否启动
27_Notification
我的人生,需要一个计划
一个经典的导航条
wierd issue just marked it when I am free to trace the source code
MySql.Data.MySqlClient.MySqlException: The user specified as a definer ('root'@'%') does not exist
how to debug smarty with firebug
how to restore 'show desktop’ icon
Serialize an Object Using JSON
how to input the single quote in the phpmyadmin
热门文章
how to handle with single quote in ms sql server
plt_在图片中绘制标记框
xml_以字典形式返回xml文件中的标注信息
xml_python_查看xml中所有的标记数据
【视频处理】
xml文件_解析示例_python实现
plt_旋转标记框_绘制在图片上
Android requires compiler compliance level 5.0 or 6.0. Found '1.7' instead. Please use Android Tools > Fix Project Properties.
android日常问题及解决方案
sql 分割字符串
Copyright © 2011-2022 走看看