Cannot apply indexing with [] to an expression of type 'int'

Posted by Lohith G S under C# on 8/3/2012 | Points: 10 | Views : 4021 | Status : [Member] | Replies : 1
Hi everyone,
I have a problem with gridview as i'm new to web application and expecting a solution to the below code. It goes like this,

protected void GridView1_SelectedIndexChanged(object sender, EventArgs e)
{
GridView row = GridView1.SelectedRow;
txtLastName.Text = GridView1.SelectedRow.RowIndex[0].ToString();
txtFirstName.Text = GridView1.SelectedRow.RowIndex[1].ToString();
txtEmailAddress.Text = GridView1.SelectedRow.RowIndex[2].ToString();
txtPhoneNumber.Text = GridView1.SelectedRow.RowIndex[3].ToString();
txtDOB.Text = GridView1.SelectedRow.RowIndex[4].ToString();
}


how shall i proceed. I'm getting error it reads like this Cannot apply indexing with [] to an expression of type 'int'

Thanks in advance




Responses

Posted by: Rajkatie on: 8/3/2012 [Member] [MVP] Gold | Points: 25

Up
0
Down
Kindly refer following link
http://www.codeproject.com/Questions/433897/Cannot-apply-indexing-with-to-an-expression-of-typ

Rajesh Patel
.Net Trainer(M.C.S.A | MCT)
Brainbench (Asp.Net 4.5 and C# 5.0)

Lohith G S, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response