如何在gridview中获取行数并获取第一列中的所有值(Text) [英] how to get num of row count in gridview and get all the values (Text) in first column
问题描述
嗨朋友
i必须得到gridview中的所有值或文本在第一列内的总行数..怎么做请为我提供一个代码
string itemName;
List< int32> ids = new List< int32>();
foreach(GridView1.Rows中的GridViewRow项目)
{
itemName = GridView1.Rows [item] .Cells [0] .Text;
ids.Add(从数据库中获取文本ID的方法);
}
这个代码是正确的
如果没有请告诉我实际代码
int count = grvTest.Rows.Count;
foreach (GridViewRow row in grvTest.Rows)
{
string text = row.Cells [ 0 ]。文字;
}
这样你就可以获得网格视图第1列的单元格值 >最好的办法是计算数据源中的行数。
循环通过网格视图 [ ^ ]
本文将帮助你
hi friends
i have to get the total number of rows in gridview with all values or text inside first column .. how to do it please provide me a code
string itemName;
List<int32> ids = new List<int32>();
foreach (GridViewRow item in GridView1.Rows)
{
itemName = GridView1.Rows[item].Cells[0].Text;
ids.Add(methodto get ID of text from database);
}
is this code correct
if not please show me the actual code解决方案int count = grvTest.Rows.Count; foreach (GridViewRow row in grvTest.Rows) { string text = row.Cells[0].Text; }
so that you can get the cell value of 1st column of your grid view
Your best bet is to count the rows in the data source.
Loop through the grid view[^]
This article will help you
这篇关于如何在gridview中获取行数并获取第一列中的所有值(Text)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!