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

  • Home
  • SEARCH
  • 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 8131103
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T08:58:41+00:00 2026-06-06T08:58:41+00:00

I don’t know what is the error behind the codes below, All I want

  • 0

I don’t know what is the error behind the codes below, All I want is to go back to the main page which shows a list of events from the details page of the application when the Cancel button was clicked. Right now when I clicked the Cancel button fromt eh details page, the url is sampleurl:2988/Event/Index instead of sampleurl:2988/Event/330. Any help for this is highly appreciated.

Main Page URL :
sampleurl:2988/Event/330

Details Page:
sampleurl:2988/Event/EditEventDetails/3

Here is the Routes settings.

routes.MapRoute(
                "Event", // Route name
                "Event/{id}", // URL with parameters
                new { controller = "Event", action = "Index", id = 0 } // Parameter defaults
            );

            routes.MapRoute(
                "Default", // Route name
                "{controller}/{action}/{id}", // URL with parameters
                new { controller = "Event", action = "Index", id = UrlParameter.Optional } // Parameter defaults
            );

Cancel Button use to go back to the main page:

<input type="button" id="btnCancel" url="@Url.Action("Index", "Event", new { id = Model.EM_AID })" value="Cancel" class="button cancelbutton"/>

Jquery Code:

$("#btnCancel").click(function () {
    window().location.href =  $(this).attr('url');
});
  • 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-06T08:58:45+00:00Added an answer on June 6, 2026 at 8:58 am

    You will need to pass the id=330 which was present in your first page to your details page so that you can correctly generate the return url. Also you could use an ActionLink, no need to use javascript:

    @Html.ActionLink(
        "Cancel",                               // linkText
        "Index",                                // action
        "Event",                                // controller
        new { id = Model.IdFromTheFirstPage },  // routeValues
        new { @class = "cancelbutton" }         // htmlAttributes
    )
    

    So here’s the workflow:

    1. User visits /Event/330 and clicks on a details link to edit the details of a given event
    2. User is redirected to /Event/EditEventDetails/3?IdFromTheFirstPage=330
    3. The user clicks on the Cancel button and is brought back to the original page
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Don't know if I worded the question right, but basically what I want to
Don't know what to do with this error. How to add data in SQL
I don't have much PHP experience and I want to know how to best
Don't know why this conversion fails. SELECT CAST('32.999' AS INT) throws the error saying
don't know if the title describes anything about what I'm trying to say but
don't know what happened in my jcrop selection. I think I pressed some keys
Don't really know how to formulate the title, but it should be pretty obvious
Don't know how to google for such, but is there a way to query
Don't know why but font is not displaying.Please help. CSS(in css folder): style.css: @font-face
I don't know why, but this code worked for me a month ago... maybe

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.