日期:2008-05-28  浏览次数:20649 次

<%@ Page Language="C#"%>
<%@ Import Namespace="System.Data"%>

<script Language="C#" Runat="Server">
public void Page_Load(Object src,EventArgs e)
{
int i;
DataTable dt=new DataTable();
DataRow dr;
dt.Columns.Add(new DataColumn("编号"));
dt.Columns.ADD(new datacolumn("用户名"));
for(i=1;i<8;i++)
{
dr=dt.NewRow();
dr[0]=Int32.ToString(i);
dr[1]="ASPcn"+Int32.ToString(i);
dt.Rows.Add(dr);
}
DG1.DataSource = new DataView(dt);
DG1.DataBind();

}
</script>
<HTML>
<head>
<title></title>
</head>
<body>
<ASP:DataGrid id="DG1" runat=server align=center HeaderStyle-BackColor="#aaaadd"/>
</body>
</HTML>