如果没有要显示的数据,请在gridview上单击按钮添加行 [英] adding rows in gridview on button click if there is no data to display

查看:97
本文介绍了如果没有要显示的数据,请在gridview上单击按钮添加行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果没有数据源绑定到gridview,然后通过单击也具有每行编辑,更新功能的按钮,只需在空gridview中添加带有模板字段的空行,是否有可能?之后,当所有添加行的单元格都具有值时,然后将该girdview的数据插入sql表中?

我想通过编辑和更新每一行来显示空的Gridview,还可以在页面加载时添加行功能


在此先谢谢您

is this possible if there is no data source to bind the gridview then just add the empty rows with templated fields in empty gridview by clicking a button also with edit, update functionality of each row? after that when all the cells of added rows would have value then insert the data of that girdview into sql table?

i want to show empty Gridview with editing and updating the each row also with adding rows functionality on page load


Thanks in advance

推荐答案

是的,您可以在网格中添加空行.
你可以做
yes you can add empty rows in a grid.
you can do
if(Gridview.rows.count==0)
{ 


DataTable dt = new DataTable();


dr = dt.NewRow();


Gridview.DataSource = dt;


}


这篇关于如果没有要显示的数据,请在gridview上单击按钮添加行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆