Click here to Skip to main content
15,891,621 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello all,

I am working on gridview and i have 1 autogenerated button column.
In that button i have coding for email.
Now i need to extract emailid which is on say column[4] of gridview.
So How can i retrieve value
for ex:
row 1 column 4 ?

Now my problem is that i am getting row count and iterating throught it properly
but when i am using Cells[4].text i am not getting any values instead it is blank
why is it ?
below is my code

C#
foreach (GridViewRow row in GridView1.Rows)
       {
           string val = row.Cells[4].Text;
           Response.Write(val);
       }
Posted
Comments
Laiju k 20-Oct-14 7:08am    
confirm it is on Cell[4].Hide columns also count 1

1 solution

To get the value of fourth column use the syntax:
GridView1.Rows[i].Cells[3].Text
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900