Returning to previous page
<p>If a user is making an edit and clicks cancel, how can i return them to the page before the edit was made? Not jus refering them back to the previous page, but referring them back to how it was before they decided to edit.</p>

<p>If i need to me more thorough please ask.</p>

<p>I used this code but it just refers back to the previous page. I had a previous thread about a problem but couldnt find the solution.</p>

<p>When a user clicks add new row button it opens up the new row in a edit and cancel form. If the user clicks cancel it automatically adds the row as blank, I dont want that I want the row to be deleted. I was thinking if I could set it to return to its orginal form  before the new row was created oit would work the same way.</p>

<pre><code>   protected void gv_RowCommand(object sender, GridViewCommandEventArgs e)
    {
        if (e.CommandName == "Insert") //- this is needed to explain that the INSERT command will only work when INSERT is clicked
        {
            dbcon.Execute("INSERT INTO PROJ_ASP (TRANS_CD) VALUES('')", "ProjectASPConnectionString");

            gv.DataBind();
            gv.EditIndex = gv.Rows.Count - 1;
            gv.DataBind();


        }
    }
    protected void gv_RowCancelingEdit(object sender, GridViewCancelEditEventArgs e)
  {

        ///When cancel is clicked, redirect page to orginal page

      Response.Redirect("Default.aspx");
</code></pre>

<p>I actually think I understand what my issue is, the way I setup it up is anytime the user clicks INSERT it automatically adds a blank row into the database REGARDLESS if its empty. What can i do to not allow it to insert it into the database until all rows are complete? Im assuming its a code i would be placing under gv_RowCommand</p>
