can't retrieve data from rowupdating event gridview control

  • Thread starter Thread starter Paul
  • Start date Start date
P

Paul

In the code below the first line works to read data from the gridview control
but the second line the ltest label is null. The very first column of the
grid is a bound data item that I converted to a template column. This column
has a label called lblDiscID which gets populated on the gridview control
correctly. Thanks.

protected void gridview_RowUpdating(object sender, GridViewUpdateEventArgs
e)
{

string DiscDescrip =
Convert.ToString((gridview.Rows[e.RowIndex].Cells[5].FindControl("txbxDiscgv") as TextBox).Text);

Label ltest = (gridview.Rows[e.RowIndex].Cells[0].FindControl("lblDiscID")
as Label);

ltest is always null!
 
Hi thanks for the response. I was able to get it to work but the users want
to be able to make several changes in different rows and then just hit a
button to save it.
I could get this to work if I could access the gridview data (including new
changes) in the save button click event or the rowdatabound event. I was
able to get the data off of the grid in the rowdatabound event but it did not
seem to include any of the new data changes on the grid.
 
Back
Top