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


I have bind one gridview which have DatakeyName=OrderID. Now i want to get all the datakeyName value. Means if in gridview 50 record bind then i want all the datakey value of that...

Can any one tell me that how can i do that...!!!!


Thank You to All In Advance...
Posted

1 solution

Hello,

Please try below logic to achieve it.


C#
foreach(GridViewRow row in GridView1.Rows)
{
    string index = Convert.ToString(GridView1.DataKeys[row.RowIndex].Value);
    // Do something
}


Please let us know if any.
 
Share this answer
 
Comments
Yatin chauhan 1-Oct-12 9:44am    
I have do the same for that. but i get only 3 or 4 rowindex value and again it start from begin....!!!

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