如何将Gridview中的Cell值分配给变量 [英] How to assign a Cell value from Gridview to a variable

查看:62
本文介绍了如何将Gridview中的Cell值分配给变量的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想将GV行的Cell5中的值赋给变量'dd'。

我使用了以下代码,但得到的错误如下:错误4非可调用成员'System.Web。 UI.WebControls.GridView.Rows'不能像方法一样使用。



I want to assign the value in Cell5 of GV row to a variable 'dd'.
I used the following code but get error like: Error 4 Non-invocable member 'System.Web.UI.WebControls.GridView.Rows' cannot be used like a method.

int ii;
for (ii = 0; ii <= GridView3.Rows.Count; ii++)
{
    string dd = GridView3.Rows(ii).Cells[5].Text;
}

推荐答案

string dd = GridView3.Rows [ii] .Cells [5] .Text;
string dd = GridView3.Rows[ii].Cells[5].Text;


这篇关于如何将Gridview中的Cell值分配给变量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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