功能齐全的DataGrid

王朝other·作者佚名  2006-11-24
窄屏简体版  字體: |||超大  

功能齐全的DataGrid

//目前功能:排序、单选项、复选项、合并单元格、产生序列号、联动下拉框、鼠标移动改变颜色、奇偶项颜色区分

//后续再加:分页、统计

1.html代码

<HTML>

<HEAD>

<title>DatagridTest</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">

function fun_option(obj)

{

document.Form1.hiduserid.value=obj.value;

alert(obj.value);

}

function chkAll_true()

{

var chkall= document.all["chkAll"];

var chkother= document.all["chkExport"];

if(chkother.length>0)

{

for (var i=0;i<chkother.length;i++)

{

if(chkall.checked==true)

{

chkother[i].checked=true;

}

else

{

chkother[i].checked=false;

}

}

}

}

</script>

</HEAD>

<body>

<form id="Form1" method="post" runat="server">

<TABLE id="Table1" height="100%" cellSpacing="1" cellPadding="1" width="100%" border="1">

<tr height="30">

<td><INPUT id="chkAll" onclick="chkAll_true()" type="checkbox">全选/取消</td>

</tr>

<TR vAlign="top">

<TD width="100%"><asp:datagrid id="DataGrid1" runat="server" ForeColor="Black"

GridLines="None" CellPadding="2"

BackColor="LightGoldenrodYellow" BorderWidth="1px" BorderColor="Tan"

AllowSorting="True" AutoGenerateColumns="False"

DataKeyField="UserID" OnUpdateCommand="Update" OnCancelCommand="Cancel"

OnEditCommand="Edit">

<FooterStyle BackColor="Tan"></FooterStyle>

<SelectedItemStyle ForeColor="GhostWhite"

BackColor="DarkSlateBlue"></SelectedItemStyle>

<AlternatingItemStyle BackColor="PaleGoldenrod"></AlternatingItemStyle>

<HeaderStyle Font-Bold="True" BackColor="Tan"></HeaderStyle>

<Columns>

<asp:TemplateColumn HeaderText="No">

<ItemTemplate>

<INPUT id="radio" type="radio" name="radio"

onclick="fun_option(this)" value='<%# DataBinder.Eval(Container.DataItem,"UserID") %>'>

 

[1] [2] [3] [4] [5] [6] [7] 下一页

 
 
 
免责声明:本文为网络用户发布,其观点仅代表作者个人观点,与本站无关,本站仅提供信息存储服务。文中陈述内容未经本站证实,其真实性、完整性、及时性本站不作任何保证或承诺,请读者仅作参考,并请自行核实相关内容。
 
 
© 2005- 王朝網路 版權所有 導航