呵呵,仅IE有效:)
前台代码:
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd ">
http://www.w3.org/1999/xhtml " >
classe partielle publique _Default : System.Web.UI.Page
{
protected void Page_Load (expéditeur de l'objet, EventArgs e)
{
si (!IsPostBack)
{
GridView1.Style.Add("position", "absolu");
GridView1.DataSource = GetDataSet();
GridView1.DataMember = "table de test" ;
GridView1.DataBind();
}
}
DataSet privé GetDataSet()
{
DataTable dt = new DataTable("table de test");
dt.Columns.Add("Col1", typeof(int));
dt.Columns.Add("Col2", typeof(string));
dt.Columns.Add("Col3", typeof(string));
dt.Columns.Add("Col4", typeof(string));
DataRow dr ;
pour (int i = 0; i < 10; i++)
{
dr = dt.NewRow();
dr[0] = je;
dr[1] = "Val" + i.ToString();
dr[2] = "Val" + i.ToString();
dr[3] = "Val" + i.ToString();
dt.Rows.Add(dr);
}
DataSetds = new DataSet();
ds.Tables.Add(dt);
retourner ds ;
}
}
http://luoboqingcai.cnblogs.com/archive/2006/07/01/440514.html