冻结DataGrid中的列的比较简单的实现方法!
<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>
<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
}
浙公网安备 33010602011771号