首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > asp.net >

|M| 当小弟我的DataGrid绑定后小弟我想要再添加多一行要怎么处理 多谢

2012-01-02 
|M| 当我的DataGrid绑定后我想要再添加多一行要怎么办 谢谢如绑定后yearmonthtotal2007111200611102006121

|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();
}
[解决办法]

[解决办法]
重新绑定

热点排行