网格视图列到数组 [英] Grid view Column into Array

查看:66
本文介绍了网格视图列到数组的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

我有一个网格视图,其中有6列,第六列包含电子邮件地址,我希望仅将第六列放入数组中,然后使用该数组发送邮件


请在这方面指导我,或者如果有人有它的代码,请给我

在Advance中致谢

Hi All,

I have a grid view in which there are 6 columns ,the sixth clumn contains email addresses, i want that only the sixth column is put into an array and then i send mail on that using the array


Please guide me in this regard or if any one has a code of it then give me

Thanks in Advance

推荐答案

您对数组的意思是什么?

它不是您需要查看的GridView,而是绑定到它的DataSource.

What do you mean out into an array?

It''s not the GridView you need to look at but rather the DataSource that is bound to it.

List<string> emails = new List<string>();
DataTable dt = (DataTable)grid.DataSource;
foreach(DataRow row in dt.Rows)
{
   emails.Add(row[5]); 
}


尝试一下

Try this

string[] arrEmail=new string[dgvList.Rows.Count];
for (int i = 0; i < dgvList.Rows.Count-1; i++)
{
  arrEmail[i] = dgvList.Rows[i].Cells[5].Value.ToString();                
}


这篇关于网格视图列到数组的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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