I am trying to get access to the data in different rows of my gridview
on a button click, in a similar way to the one I used with my 1.1
datagrids. But the cells always seem to be empty. Here is my code :
protected void btnSubmit_Click (object sender, EventArgs e)
{
//get list of pkcustomerrecor ds and email addresses, put into
generic list
List<EmailDetai lsem = new List<EmailDetai ls>();
int intPKCustomerRe cord;
string strConsultant;
string strEmailAddress ;
for (int i = 0; i < GridView1.Rows. Count; i++)
{
if
(((CheckBox)Gri dView1.Rows[i].FindControl("c hkSendEmail")). Checked ==
true)
{
intPKCustomerRe cord =
Convert.ToInt32 (GridView1.Rows[i].Cells[3].Text);
strConsultant =
Convert.ToStrin g(GridView1.Row s[i].Cells[2].Text);
strEmailAddress =
Convert.ToStrin g(GridView1.Row s[i].Cells[1].Text);
EmailDetails ed = new EmailDetails();
ed.PKCustomerRe cord = intPKCustomerRe cord;
ed.Consultant = strConsultant;
ed.EmailAddress = strEmailAddress ;
em.Add(ed);
}
}
Can anybody help me out?
*** Sent via Developersdex http://www.developersdex.com ***