SIVA

SIVA

  • NA
  • 742
  • 707.4k

Not retrieving the values from GridView

Dec 28 2011 7:04 AM
Hi All,
I have GridView with Edit & Delete command
when i am trying to update the data in gridview its taking previous data only.
my code is as follows

RowUpdating :
oProp.DNo =int.Parse(gvDept.Rows[e.RowIndex].Cells[0].Text);
oProp.DName = ((TextBox)(gvDept.Rows[e.RowIndex].Cells[1].Controls[0])).Text;
oProp.Location = ((DropDownList)(gvDept.Rows[e.RowIndex].FindControl("DDList"))).Text;
oData.UpdateDetails(oProp);
gvDept.EditIndex = -1;
gvDept.DataSource = oData.ShowDetails();
gvDept.DataBind();
UpdateDetails:
oCmd.Parameters.Clear();
oCmd.CommandText ="tbl_Department_InsertOrUpdate";
oCmd.Parameters.AddWithValue("DNo",oProp.DNo);
oCmd.Parameters.AddWithValue("DName",oProp.DName);
oCmd.Parameters.AddWithValue("Location",oProp.Location);
oCon.Open();
oCmd.ExecuteNonQuery();
oCon.Close();
I have traced this its not retrieving values from Gridview its taking the previous values and its performing the update operation

Answers (2)