Click here to Skip to main content
12,944,138 members (61,800 online)
Rate this:
Please Sign up or sign in to vote.
See more:
<asp:BoundField DataField="Id" HeaderText="Id" ReadOnly="True" SortExpression="Id"
                                    ItemStyle-CssClass="ItemPixel" />

How to get all the values from this column of gridview in c#.

Binding grid using Datasource


I want 1,2,3 in c# ON button click event
Posted 1-Feb-13 7:35am

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

string index = string.empty;
foreach(GridViewRow row in GridView1.Rows)
    index = index + "," + Convert.ToString(GridView1.Cells[0].Value);
return index,substring(0, index.Length - 2);
Member 9581488 1-Feb-13 13:50pm
error : some invalid arg
Abhinav S 1-Feb-13 14:06pm
Try now.
Member 9581488 1-Feb-13 14:08pm
thank you..Its working now.I thought we have similar kind of accessibility for gridview columns like we have for row.
Thank you!

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

    Print Answers RSS
Top Experts
Last 24hrsThis month
OriginalGriff 4,643
CHill60 2,970
Maciej Los 2,348
Jochen Arndt 1,900
ppolymorphe 1,765

Advertise | Privacy | Mobile
Web02 | 2.8.170518.1 | Last Updated 1 Feb 2013
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100