Hi all,
I need to read the allcolumns of a row in a gridview. I use the following code to do so.
foreach (GridViewRow row in gridvw.Rows)
{
DataRow dr;
dr = table.NewRow();
//string str = gridvw.Rows(0).Cells(0).Text;
for (int i =0; i < row.Cells.Count-1; i++)
{
dr[i] = row.Cells[i].Text.Replace(" ", " ");
}
table.Rows.Add(dr);
}
Am adding all the values to a table. The above code returns nothing for the first 2 columns of each and every row.
The grid mock up is
S.No name address and so on
Can anybody help on this issue?
Thanks in Advance,
Joseph
Then maybe start the loop at 2 instead of zero.
Are you expecting values from columns 1 & 2? I, for one, have no clue what your grid looks like.
Are the first two columns of your GridView TemplateField's, by any chance?
Hi,
Can you post the markup of your grid view for those two columns that can help us to understand.
No the loop starts at zero. I have updated my question with grid mockup.
All columns are databound columns
沒有留言:
張貼留言