Gridview单元格值 [英] Gridview cell values

查看:69
本文介绍了Gridview单元格值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在gridview中从数据库中获取数据并尝试获取字符串变量或标签中的值,但是以下代码不起作用:

I am fetching data from database in gridview and trying to take value in string variable or label, but the following code is not working:

For t As Integer = 0 To GridView1.Rows.Count
           lblsubheader.Text = (GridView1.Rows(t).Cells(1).Text)

推荐答案

for each row as Gridview.Row in Gridview1.Rows

     lblsubheader.Text = row.Cells(1).Text
Next


for(int i=0;i< gridview1.rows.count-1;i++)
{
   label1.text=gridview1.rows[i].cells[0].text;
   label2.text=.....
}


u可以写这个

u can write this

For Each gvr As GridViewRow In GridView1.Rows
                   
                   lblsubheader.Text = gvr.Cells("urColumnName").Text

               Next gvr


这篇关于Gridview单元格值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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