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 8612881
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T04:44:09+00:00 2026-06-12T04:44:09+00:00

So I have this page which will show an individual record from a database.

  • 0

So I have this page which will show an individual record from a database. So my URL will look like:

mysite.com/Vehicle/Edit/1

or it may end it 2,3,4,5 etc.. depending on the record its on. Basically I need a link in this page that will take me to another page but have the same value in the url, so it could look like:

mysite.com/Owner/Add/1

Or it could end in 2,3,4,5 etc.. depending on which record the link was in.

How do I do this using C# MVC, im using Razor if that makes any difference.
Thanks

  • 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-12T04:44:11+00:00Added an answer on June 12, 2026 at 4:44 am

    You’ll want to use one of the Html.ActionLink helpers.

    Say you’re passing in a Model to your view that has a property called Id. You could use Html.ActionLink like this:

    @Html.ActionLink("Add Owner", "Add", "Owner", new { id = Model.Id }, null)

    The first argument is the text that the link will display.
    The second argument is the name of the Action to call.
    The third argument is the name of the Controller the Action is in.
    The fourth argument is the route values for the Action.
    The fifth argument is for html attributes. Say you wanted to add a class to your link. Instead of null, you could use new { @class = "my-link-class" }. Notice the @ in front of class. That is because class is a reserved word. If you were setting style, you would just do this: new { style = "background-color: #ffffff;" }.

    All of this is assuming your Add Action takes in an int id. So something like this:

    public ActionResult Add(int id)
    {
       // Do stuff.
    }
    

    Here are the docs for the specific Html.ActionLink overload I used in my example: http://msdn.microsoft.com/en-us/library/dd504972(v=vs.108).aspx

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

Sidebar

Related Questions

I have a select box on a classic ASP page which looks like this:
I have an xml file which I imported in my html page like this:
I have this page which has three peson searchs on them. Basically it's a
I have this html page which is very simple, it contains a text box
I have a page which has document.body.onload=function(){...} but this is suffering delays because the
I have one master page which applies to all pages in this website. On
On my main page I have this jquery code which does an ajax call
I have a javascript page which checks an email and username, this works fine
I have a jsp page which needs a java code. This java code inside
I'm using ExtJS on a registration page which should have no effect on this.

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.