日月更替,天地輪回,人間已是幾回春。 江山不老,人正少年,只手能擎半邊天。
我已经改成你那样的了,然后怎么作呀
<HTML>
<HEAD>
<title>DGHandle</title>
<meta content="Microsoft Visual Studio .NET 7.1" name="GENERATOR">
<meta content="C#" name="CODE_LANGUAGE">
<meta content="JavaScript" name="vs_defaultClientScript">
<meta content="http://schemas.microsoft.com/intellisense/ie5" name="vs_targetSchema">
<script language="javascript" src="GridColorControl.js">
function check(obj)
{
if(obj.checked==true)
{
selectAll();
}
else
{
cancelAll();
}
}
function selectAll()//全选
{
var ele = document.Form1.elements;
for(i = 0;i < ele.length;i ++)
{
if(ele[i].type == "checkbox" && ele[i].id != 'cbAll')
{
ele[i].checked = true;
}
}
}
function cancelAll() //取消全选
{
var ele = document.Form1.elements;
for(i=0;i<ele.length;i++)
{
if(ele[i].type == "checkbox" && ele[i].id != 'cbAll')
{
ele[i].checked = false;
}
}
}
</script>
</HEAD>
<body MS_POSITIONING="GridLayout">
<form id="Form1" method="post" runat="server">
<table>
<tr>
<td style="HEIGHT: 21px" align="right"><asp:label id="lblPageNumber" runat="server" Font-Name="verdana" Font-size="8pt" ForeColor="navy"></asp:label>
<asp:linkbutton id="btnFirst" onclick="PagerButtonClick" runat="server" Font-Name="verdana" Font-size="8pt"
ForeColor="navy" CommandArgument="0" Enabled="False"></asp:linkbutton>
<asp:linkbutton id="btnPrev" onclick="PagerButtonClick" runat="server" Font-Name="verdana" Font-size="8pt"
ForeColor="navy" CommandArgument="prev" Enabled="False"></asp:linkbutton>
<asp:linkbutton id="btnNext" onclick="PagerButtonClick" runat="server" Font-Name="verdana" Font-size="8pt"
ForeColor="navy" CommandArgument="next"></asp:linkbutton>
<asp:linkbutton id="btnLast" onclick="PagerButtonClick" runat="server" Font-Name="verdana" Font-size="8pt"
ForeColor="navy" CommandArgument="last"></asp:linkbutton></td>
</TD>
<tr>
<td><FONT face="宋体">
<!--加入Div显示滚动条-->
<div id="divtemp1" style="OVERFLOW: auto; WIDTH: 600px; HEIGHT: 400px">
<div id="divtemp2" style='WIDTH:1px'></div>
<asp:datagrid id="DataGrid1" runat="server" AutoGenerateColumns="False" AllowSorting="True" CellPadding="3"
BackColor="White" BorderWidth="1px" BorderStyle="None" BorderColor="#CCCCCC" Width="528px"
Height="208px" AllowPaging="True" PageSize="20">
<FooterStyle ForeColor="#000066" BackColor="White"></FooterStyle>
<SelectedItemStyle Font-Bold="True" ForeColor="White" BackColor="#669999"></SelectedItemStyle>
<ItemStyle ForeColor="#000066"></ItemStyle>
<HeaderStyle Font-Bold="True" ForeColor="White" BackColor="#006699"></HeaderStyle>
<Columns>
<asp:TemplateColumn HeaderText="自动序号">
<ItemTemplate>
<%# DataGrid1.CurrentPageIndex * DataGrid1.PageSize + Container.ItemIndex + 1 %>
<!--Container.ItemIndex表示DataGrid当前行索引-->
</ItemTemplate>
</asp:TemplateColumn>
<asp:BoundColumn DataField="OrderID" SortExpression="OrderID" HeaderText="编号"></asp:BoundColumn>
<asp:BoundColumn DataField="OrderDate" SortExpression="OrderDate" HeaderText="日期"></asp:BoundColumn>
<asp:BoundColumn DataField="ShipCountry" SortExpression="ShipCountry" HeaderText="城市"></asp:BoundColumn>
<asp:TemplateColumn HeaderText="选择">
<HeaderTemplate>
<input runat="server" id="cbAll" type="checkbox" onclick="check(this)" />全选
</HeaderTemplate>
<ItemTemplate>
<asp:CheckBox id="cb1" runat="server"></asp:CheckBox>
</ItemTemplate>
</asp:TemplateColumn>
<asp:TemplateColumn>
<ItemTemplate>
<asp:LinkButton id="lbDelete" runat="server" CommandName="Delete">删除</asp:LinkButton>
</ItemTemplate>
</asp:TemplateColumn>
</Columns>
<PagerStyle HorizontalAlign="Left" ForeColor="#000066" BackColor="White" Mode="NumericPages"></PagerStyle>
</asp:datagrid>
<!--滚动条滚动时页眉始终显示-->
<script language="javascript">
try
{
if (typeof(DataGrid1)=='object')
{
divtemp2.style.posHeight=DataGrid1.rows(0).offsetHeight;
DataGrid1.rows(0).style.position='absolute';
DataGrid1.rows(0).style.setExpression('top','divtemp1.scrollTop');
DataGrid1.rows(0).style.left=0;
}
}
catch(e)
{
alert(e);
}
</script>
</div>
</FONT>
</td>
</tr>
</table>
</form>
</body>
</HTML>