c0dehunter
c0dehunter

Reputation: 6140

ASP.net: GridView trouble getting updated values

I am using *GridView1_RowUpdating* event which is called after clicking "Update" link. In the method I handle updating of the GridView. I want to get the values from textboxes (i.e. new values):

string title= ((TextBox)GridView1.Rows[e.RowIndex].Cells[1].Controls[0]).Text;

But strangely I get old value. I've debugged but couldn't find where the error is.

Also, e.NewValues.Count is 0.

Upvotes: 0

Views: 606

Answers (2)

Sarim Sidd
Sarim Sidd

Reputation: 2176

you need to bind data to the gridView control

Upvotes: 0

c0dehunter
c0dehunter

Reputation: 6140

The problem was I was doing GridView.DataBind() everytime in page_load. Solved now.

Upvotes: 1

Related Questions