can't retrieve data from rowupdating event gridview control

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!
 
P

Paul

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,770
Messages
2,569,584
Members
45,077
Latest member
SangMoor21

Latest Threads

Top