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 pkcustomerrecords and email addresses, put into
generic list
List<EmailDetailsem = new List<EmailDetails>();
int intPKCustomerRecord;
string strConsultant;
string strEmailAddress;
for (int i = 0; i < GridView1.Rows.Count; i++)
{
if
(((CheckBox)GridView1.Rows[i].FindControl("chkSendEmail")).Checked ==
true)
{
intPKCustomerRecord =
Convert.ToInt32(GridView1.Rows[i].Cells[3].Text);
strConsultant =
Convert.ToString(GridView1.Rows[i].Cells[2].Text);
strEmailAddress =
Convert.ToString(GridView1.Rows[i].Cells[1].Text);
EmailDetails ed = new EmailDetails();
ed.PKCustomerRecord = intPKCustomerRecord;
ed.Consultant = strConsultant;
ed.EmailAddress = strEmailAddress;
em.Add(ed);
}
}
Can anybody help me out?
*** Sent via Developersdex http://www.developersdex.com ***