Last post Nov 12, 2010 04:39 PM by ramesh866
Nov 12, 2010 12:56 AM|snigdharjun|LINK
I have a grid view as follows
ID Name Date total Balance
1 abcd 1/1/2010 2500 2500
2 efgh 4/5/2010 2000 3000
Each time wen the grid view is displayed I want the values of each row to update my table. So is there any way to get each of these rows values in a label or textbox.
i e Can i store value 1 in LblID1, 2 in LblID2, 3in LblID3 and so on
abcd in LblName1, efgh in LblName2........
2500 in Ltotal1, 2000 in Ltotal2.........
Can any body help me in this regard..please
Nov 12, 2010 03:44 AM|bhavik.y.shah|LINK
You can do it.
But the thing is that you may know that how many rows you have.
AS well as you can create dynamic variable and store in that you need to do is iterate loop from 0 to count of gridview rows and get value of each column in that row.
Nov 12, 2010 03:45 AM|ramesh866|LINK
ya you can use l
abel2.text=gridview1.Cells.Text; and so on
Nov 12, 2010 04:14 AM|snigdharjun|LINK
Yes. but I cannot specify how many rows are there in the gridview because its retrieving records based on date. and i don know how many are there on that particular date.
Nov 12, 2010 04:39 PM|ramesh866|LINK
add an event called OnRowDataBound="GridView1_DataBound"
protected void GridView1_DataBound(object sender, GridViewRowEventArgs e)
if (e.Row.RowType == DataControlRowType.DataRow)
for (int i = 0; i < e.Row.Cells.Count; i++)
this.Label1.Text += e.Row.Cells[i].Text + "</br>";
let me know if this has sufficed yr req