Hi experts, I'm having trouble handling a GridView rowUpdating event.
I have a page with a gridview like so:
GridView1.DataSource = datasets.Tables;
Key properties on the GridView are:
AutoGenerateEditButton="True", OnRowEditing="GridView1_RowEditing" , OnRowUpdating = "GridView1_RowUpdating"
Here's the handlers:
protected void GridView1_RowEditing(object sender, GridViewEditEventArgs e)
GridView1.EditIndex = e.NewEditIndex;
string EditIndex = GridView1.EditIndex.ToString();
protected void GridView1_RowUpdating(object sender, GridViewUpdateEventArgs e)
GridViewRow row = GridView1.Rows[e.RowIndex];
if (row != null)
TextBox t = row.FindControl("TextBox1") as TextBox;
if (t != null)
Response.Write("The Text Entered is: " + t.Text); // ****this is the problem here****
In the Response.Write statement, I retrieve the value thats is being edited. To my surprise I get the original value - not the new value entered by the user.
Example: Lets say I click the edit button on row 10 of my gridview. This brings up a templated view of row 10 with the "update" and "cancel" commands in the first column. I'll change the value inside my editable columm from "Around the Horn" to "Circle the Horns". Then I click "update". This fires the rowupdating event - and the text rendered is "The Text Entered is: Around the Horn".
How is it that I can get the new value so that i can create a parameter from it and handle the event properly?????? please help