将插入按钮添加为gridview中页脚的最后一列,运行时未知的列数 [英] Adding insert button as last column at footer in gridview with number of columns not known at runtime
问题描述
我有一个gridview控件.我试图根据表名(每个表中的列数不同)将Gridview与各种表数据绑定,并且在绑定数据后,我想通过添加插入"按钮来实现插入功能由于我确实知道每个表在运行之前的列数,因此我如何才能在页脚的最后一列中准确添加插入按钮.当单击插入按钮时,也需要向gridview添加新行所有列的文本框(直到运行时才知道列数).
请任何人对此提供帮助.
谢谢,
Prashanth
Hi,
I have a gridview control.I am trying to bind the gridview with various tables data based on table name(number of columns in each table varies) and after binding the data i want to implement the insert functionality by adding an "insert" button as last column in footer of gridview.Since i do know the number of columns until runtime for each table, so how can i add the insert button exactly at last column in footer.Also when insert button is clicked need to add new row to gridview with textboxes for all the columns (number of columnms are not known until runtime).
Please anyone help on this.
Thanks,
Prashanth
推荐答案
u可以使用gridview.columns.count来计算ur gridview的列
u can use gridview.columns.count to count the columns of ur gridview
您好,
检查此链接以获取样本.
在ASP.NET Gridview中插入,更新,删除,将数据源作为SQL服务器,MS Access(mdb/accdb),XML和Framework为2.0/3.0/3.5/4.0(VS 2005/2008/2010) [
Hi,
check this link for tha sample.
Insert, Update, Delete in ASP.NET Gridview, DataSource as SQL Server, MS Access (mdb/accdb), XML and Framework as 2.0 / 3.0 / 3.5 / 4.0 (VS 2005/2008/2010)[^]
这篇关于将插入按钮添加为gridview中页脚的最后一列,运行时未知的列数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!