|M| 当我的DataGrid绑定后我想要再添加多一行要怎么办 谢谢
如绑定后
year month total
2007 1 11
2006 11 10
2006 12 12
2007 3 15
我想添加一行为
2007 4 16
谢谢
------解决方案--------------------添加后再重新绑定
protected void btnAdd_Click(object sender, EventArgs e)
{
DataTable dt = Bll.GetDataSet().Tabels[0];
DataRow newRow = dt.NewRow();
newRow[ "year "] = "2007 ";
newRow[ "month "] = "4 ";
newRow[ "total "] = "16 ";
dt.Rows.Add(newRow);
this.datagrid1.DataSource = dt;
this.datagrid1.DataBind();
}
------解决方案--------------------
------解决方案--------------------重新绑定