日期:2014-05-17 浏览次数:20481 次
protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
//初始化一个Datatable
DataTable dt = new DataTable();
dt.Columns.AddRange(new DataColumn[] {
new DataColumn("name",typeof(string)),
new DataColumn("age",typeof(string))
});
DataRow dr = null;
dr = dt.NewRow();
dr["name"] = "guwei";
dr["age"] = "30";
dt.Rows.Add(dr);
dr = dt.NewRow();
dr["name"] = "google";
dr["age"] = "28";
dt.Rows.Add(dr);
//DataList绑定这个Datatable