Hi,
Using dataset how can we retrieve cell value in a gridview? I want the secong cell value. all columns are labels..I have used this method:
Dim label lblprod=Ctype(grv.Rows(e.RowIndex).FindControl("lblprod"),label)
Also used lblprod=grv.Rows(rowindex).Cells(1).Text.. But these are not fetching the cell value.. Based on which i need to update and delete the table... Is there any other way
DataSet.Table... like that?
I am a new bieee so plzzz try to understand me and plzz explain in simple words...
Thanx....
Loading
Subhendu DePosted Dec 30, 2010, 1:47 AM
for (int i = 0; i <= rowcount - 1; i += i + 1) {The updated code would beint id = ((Label)gvr.Rows(i).FindControl("lblid")).Text;
obj.cmd.CommandText = "update tblitems set bill_number='" + billnum + "' where id='" + id + "'";
obj.cmd.ExecuteNonQuery();
foreach (GridViewRow gdRow in gdr.Rows)
{
Label lbl = gdRow.FindControl("lblid") as Label;
obj.cmd.CommandText = "update tblitems set bill_number='" + billnum + "' where id='" + lbl.Text + "'";
obj.cmd.ExecuteNonQuery();
}
Subhendu DePosted Dec 31, 2010, 1:02 AM
So your requirement is to get the label within gridview in button click event.
That's why I iterate over each row of the gridview, find the control in the row and referencing it.
That's it.....
Ananya SuhasPosted Dec 30, 2010, 11:08 PM
Suthish NairPosted Dec 29, 2010, 11:13 AM
int id = ((Label)gvr.Rows(i).Cells(1).FindControl("lblid")).Text;
Ananya SuhasPosted Dec 29, 2010, 7:45 AM
Subhendu DePosted Dec 29, 2010, 7:17 AM
In order to give you a solution, please forward the code.
Dim lblprod as label = Ctype(grv.Rows(e.RowIndex).<access Cell code>FindControl("lblprod"),label)
lblprod.Text should give the value