Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8320295
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T22:36:39+00:00 2026-06-08T22:36:39+00:00

If a user is making an edit and clicks cancel, how can i return

  • 0

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.

If i need to me more thorough please ask.

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.

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.

   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");

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

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T22:36:40+00:00Added an answer on June 8, 2026 at 10:36 pm

    you can use the ASP.NET ViewState Property to keep track of your state

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm making a page where the user upload a file. I want an if
I'm making a user profile edit form for my website, and I want to
I'm making a one-page site where the menu is fixed, so when the user
I am working on making user pages for a certain type of user who
I'm making a user control, and I manually draw the text string, but I
So I'm learning PHP with MYSQL right now. Making a user registration and mail
Im making an app that should let the user see video from the camera
I'm making a form for user creation, and I want to give one or
I'm making a custom webcam user control. I use Microsoft Expression Encoder, and set
So im making this app where user could add UP to 3 images to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.