zoukankan
html css js c++ java
冻结DataGrid中的列的比较简单的实现方法!
第一次写文章发到首页,有什么不妥的地方还请各位大虾批评!
今天看到CSDN网友有问冻结DataGrid中的列的问题,以前知道一个冻结DataGrid的
Header的方法比较简单,所以想试试!
费话少说先贴源码
<style type="text/css">
.fixTitle
{
}
{
POSITION
:
relative
;
TOP
:
expression(this.offsetParent.scrollTop)
}
.fixCol
{
}
{
POSITION
:
relative
;
Left
:
expression(this.offsetParent.scrollLeft)
}
</style>
<
DIV
style
="Z-INDEX: 102; LEFT: 264px; OVERFLOW: auto; WIDTH: 184px; POSITION: relative; TOP: 128px; HEIGHT: 216px"
ms_positioning
="GridLayout"
>
<
asp:DataGrid
id
="DataGrid1"
style
="Z-INDEX: 103"
runat
="server"
BorderColor
="#DEBA84"
BorderStyle
="None"
BorderWidth
="1px"
BackColor
="#DEBA84"
CellPadding
="0"
AutoGenerateColumns
="False"
>
<
SelectedItemStyle
Font-Bold
="True"
ForeColor
="White"
BackColor
="#738A9C"
></
SelectedItemStyle
>
<
ItemStyle
ForeColor
="#8C4510"
BackColor
="#FFF7E7"
></
ItemStyle
>
<
HeaderStyle
Font-Bold
="True"
ForeColor
="White"
BackColor
="#A55129"
></
HeaderStyle
>
<
FooterStyle
ForeColor
="#8C4510"
BackColor
="#F7DFB5"
></
FooterStyle
>
<
Columns
>
<
asp:BoundColumn
DataField
="IntegerValue"
HeaderText
="IntegerValue"
HeaderStyle-CssClass
="fixCol"
ItemStyle-CssClass
="fixCol"
></
asp:BoundColumn
>
<
asp:BoundColumn
DataField
="StringValue"
HeaderText
="StringValue"
></
asp:BoundColumn
>
<
asp:BoundColumn
DataField
="CurrencyValue"
HeaderText
="CurrencyValue"
></
asp:BoundColumn
>
</
Columns
>
<
PagerStyle
HorizontalAlign
="Center"
ForeColor
="#8C4510"
Mode
="NumericPages"
></
PagerStyle
>
</
asp:DataGrid
></
DIV
>
以前不知道从哪位高手那里看到的fixTitle的Css,在这里谢过了!
如果你想冻结那列就把 fixCol这个Css加到 那列的
HeaderStyle-CssClass 和 ItemStyle-CssClass 中去
这里我是冻结的第一列。
看看效果吧
查看全文
相关阅读:
hihocoder-Week216-Gas Stations
hihocoder-1740-替换函数
hihocoder-1732-1-偏差排列
hihocoder-Week200-Shorteniring Sequence
hihocoder-1720-小数数字
hihocoder-Week197-逆序单词
hihocoder-Week195-奖券兑换
hihocoder-Week184-满减优惠
word ladder-leetcode
数的划分
原文地址:https://www.cnblogs.com/goody9807/p/225872.html
最新文章
恢复刷题后的感觉
ubuntu服务器与本地文件传输
ubuntu 安装tomcat<服务器>
ubuntu安装jdk<服务器>
ubuntu安装mysql<服务器>
素数筛
ubuntu完全卸载nginx
欧拉筛
寒假练习 04
寒假练习 03
热门文章
寒假练习 02
寒假练习 01
SGU[127] Telephone directory
SGU[112] a^b-b^a
SGU[113] Nearly prime numbers
SGU[107] 987654321 problem
SGU[184] Patties
SGU[135] Drawing Lines
hihocoder-1796-完美K倍子数组
hihocoder-Week219-Smallest Rectangle
Copyright © 2011-2022 走看看