如何动态创建gridview rowcount ..? [英] How to get dynamically created gridview rowcount ..?

查看:85
本文介绍了如何动态创建gridview rowcount ..?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好



我有一个动态创建的网格视图。现在我尝试使用foreach(GrdDynamic.Rows中的GridViewRow gvrow)在数据库中插入行值但是它显示了行数0.但是当我将autogeneratecolumns属性设置为true时,它会给行计数和列计数准确但在获取记录时,文本框控件中的值会给出null,为什么会发生这种情况......?

Hello

I have one grid view which is dynamically created.Now I am trying to insert the row values in database using foreach (GridViewRow gvrow in GrdDynamic.Rows) but it shows row count 0.But when I set the autogeneratecolumns property true it gives row count and column count accurate but while fetching records the values from textbox controls gives null why is this happening...?

推荐答案

这是因为在每个帖子后面GridView都变空了。因此,您需要做的是在每个帖子上,您必须再次将控件添加到网格并将单元格值分配给控件。然后你可以实际循环控件来获取它们的值。
That is because on each post back GridView becomes empty. So, what you have to do is on each post back you have to again add the controls to the Grid and assign the cell values to the controls as well. Then you can actually loop through the controls to get their values.


这篇关于如何动态创建gridview rowcount ..?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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