Monday, August 17, 2009

RowUpdating doesn't work. Please help!

RowUpdating doesn't work. Please help!

Hi all,

I have a problem with RowUpdating event handler. When i click update button,it doesn't change the old values with new ones. no change in database too. This is the code behind:

protected void EditGridView_RowUpdating(object sender, GridViewUpdateEventArgs e)

{

SqlDataSource source = EditGridView.DataSource as SqlDataSource;

DataSourceSelectArguments args = new DataSourceSelectArguments();

DataView view = source.Select(args) as DataView;

DataTable dt = view.ToTable();

GridViewRow row = EditGridView.Rows[e.RowIndex];

dt.Rows[row.DataItemIndex][2] = ((TextBox)(row.Cells[3].Controls[0])).Text;

EditGridView.EditIndex = -1;

EditGridView.DataBind();

}


I tried to bind SqlDataSource before DataBind like this but didn't work.

EditGridView.DataSource = dt;

View Full Details...............................

No comments:

Post a Comment