Cannot read the first two columns of a row in a gridview

Posted by Jsphbasil under ASP.NET on 9/19/2013 | Points: 10 | Views : 652 | Status : [Member] | Replies : 2
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.

Can anybody help on this issue?

Thanks in Advance,

Joseph




Responses

Posted by: Bandi on: 9/20/2013 [Member] [MVP] Platinum | Points: 25

Up
0
Down
Can you show us the GridView design which you have in .aspx page
and also complete binding method of gridview in the .aspx.cs page

Mark This Response as Answer
--
Chandu
http://www.dotnetfunda.com/images/dnfmvp.gif

Jsphbasil, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Nismeh on: 9/20/2013 [Member] Starter | Points: 25

Up
0
Down
There can be some mistake in counter variable.

IT KNOWLEDGE IS APPLIED KNOWLEDGE
So Just Do It

Jsphbasil, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response