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>
"
;
}
}
}
}
}
查看全文
相关阅读:
如何将latex格式转换成word? Lei
SEWM2012会议报告总结 Lei
matlab图片到word的过程 Lei
日记——有点郁闷的一天
牛博国际开放了,等了一个月才能看牛博。
做什么事都没有兴趣呢,怎么这么低调呢?
读UML书
firefox弹出窗口关闭时执行代码刷新父窗口
终于关注了一下传说中的小强,firebug
MOSS Export Site Column/Site Content Type
原文地址:https://www.cnblogs.com/ringwang/p/1244346.html
最新文章
poj2255 Tree Recovery
nyoj128 前缀式计算
nyoj267 郁闷的C小加(二)
nyoj257 郁闷的C小加(一)
redux中间件reduxthunk
高阶组件HOC
react增删改查
reactredux的使用
react各种表单的写法
sql server检查临时表是否存在
热门文章
修改Hosts
FirefoxPortable的一些问题
.net IHttpHandler中使用Session
Mcfee 挡住Smtp程序
latex论文写作常见问题 Lei
no ICTCLAS2011 in java.library.path Lei
中科院计算所会议 Lei
中科院计算所会议(部分) Lei
计算机学会推荐会议 Lei
投稿会议汇总 Lei
Copyright © 2011-2022 走看看