J
JB
Hello Community
I have a Gridview.
The Gridview already uses the SelectedRow command to allowusers to
select each row and cell in the Gridview. Therefore the user can select any
row that they want.
The problem is that I need to write code that will do these things in the
order of:
1-Go to the first row in the Gridview
2-Retrieve the value from each cell
3-Store the value of each cell value in a variable
This fails:
for (int i = 1; i < gridview.Rows.Count; i++)
{
vlName = gview.Rows.Cells[1].Text;
vfname = gview.Rows.Cells[2].Text;
}
The above fails because unless a row is first selected in the Gridview, it
doesn't recognize a row in the Gridview.
If it is possible, what is the code to retrieve each row and its cells from
a Gridview programmatically without first selecting a row in the Gridview?
Thanks
Jeff
I have a Gridview.
The Gridview already uses the SelectedRow command to allowusers to
select each row and cell in the Gridview. Therefore the user can select any
row that they want.
The problem is that I need to write code that will do these things in the
order of:
1-Go to the first row in the Gridview
2-Retrieve the value from each cell
3-Store the value of each cell value in a variable
This fails:
for (int i = 1; i < gridview.Rows.Count; i++)
{
vlName = gview.Rows.Cells[1].Text;
vfname = gview.Rows.Cells[2].Text;
}
The above fails because unless a row is first selected in the Gridview, it
doesn't recognize a row in the Gridview.
If it is possible, what is the code to retrieve each row and its cells from
a Gridview programmatically without first selecting a row in the Gridview?
Thanks
Jeff