protected void UndoDel_Click(object sender, EventArgs e) { LinkButton UndoDel = (LinkButton)sender; string SQL = "UPDATE People SET Deleted = 0 WHERE PersonID = " + UndoDel.CommandArgument; Util.DoCmd(SQL); clseditmode.personid = null; this.HideForms(sender, (EventArgs)e); UndoDel.Visible = false; // Here we want to put saved DataRow into the dataset if (Session["DeletedPersonRow"] != null && Session["dts"] != null) { DataSet dts = (DataSet)Session["dts"]; DataRow dr = (DataRow) Session["DeletedPersonRow"]; dts.Tables[0].Rows.InsertAt(dr, (int)ViewState["DeletedRowIndex"]); dts.AcceptChanges(); Session.Remove("DeletedPersonRow") ; ViewState.Remove("DeletedRowIndex") ; Session["dts"] = dts; this.ProfilesGrid.DataBind(); } }What it does it restores the person in the database and inserts an empty record into my DS at the right place. But I don't want an empty record! I want to see the record with data that I attempted to save using this code
if (Session["dts"] != null) { DataSet dts = (DataSet)Session["dts"]; this.DeletedPersonRow = dts.Tables[0].Rows[pi]; //Save Person we're about to delete Session["DeletedPersonRow"] = this.DeletedPersonRow; this.DeletedRowIndex = pi; ViewState["DeletedRowIndex"] = this.DeletedRowIndex; dts.Tables[0].Rows[pi].Delete(); dts.AcceptChanges(); ProfilesGrid.DataSource = dts; ProfilesGrid.DataBind(); Session["dts"]= dts; }So, somehow this is not correct way dealing with records in DataSet. I need a bit help here to understand if I'm going in the right direction with this or not.