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

gridview在客户端平添一行

2011-12-17 
gridview在客户端添加一行asp:GridView使用DataSourceIDSqlDataSource1如何在public void custom_rowco

gridview在客户端添加一行
asp:GridView使用DataSourceID="SqlDataSource1"
如何在public void custom_rowcomand(Object sender, GridViewCommandEventArgs e)事件中在客户端增加一行,而不是通过重新绑定数据库
例如:
列1 列2 列3
a b 增加一条记录
c d 增加一条记录
通过点击增加一条记录,实现
列1 列2 列3
a b 增加一条记录
a b 增加一条记录
c d 增加一条记录

[解决办法]
没试,但觉得应该override Reander()方法。

Table gridTable = (Table)GridView1.Controls[0];


GridViewRow row = new GridViewRow(rowIndex, rowIndex, DataControlRowType.DataRow, DataControlRowState.Normal);
TableCell cell = new Cell();
//Cell里增加几列TextBox
row.Cells.Add(cell);
gridTable.Contrls.Add(rowIndex, row);

....


这个rowIndex是否需要存在ViewState里,还是楼主自己试试吧。

热点排行