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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T07:52:21+00:00 2026-06-04T07:52:21+00:00

when I use the following actionlink: <%: Html.ActionLink(Study Cases, Index, CourseCases, new { id

  • 0

when I use the following actionlink:

<%: Html.ActionLink("Study Cases", "Index", "CourseCases", new { id = Model.ID }, new { @class = "t-button", @style = "width:240px; color:white; text-align:center" })%>

The url address in the browser is:

http://localhost:11111/CourseCases/Index/9

How can I change it so the url will be

 http://localhost:11111/CourseCases?courseId=9

It works when I use:

 return RedirectToAction("Index", "CourseCases", new { courseId = id });

in the controller.
Thanks in adance.

  • 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-04T07:52:22+00:00Added an answer on June 4, 2026 at 7:52 am

    Like this:

    <%= Html.ActionLink(
        "Study Cases", 
        "Index", 
        "CourseCases", 
        new { courseId = Model.ID }, 
        new { 
            @class = "t-button", 
            @style = "width:240px; color:white; text-align:center" 
        }
    ) %>
    

    The reason why your code generates http://localhost:11111/CourseCases/Index/9 is because the {id} is used by the default route that was generated when you created your ASP.NET MVC 3 application, so when you specify id = Model.ID it will match the route pattern definition in your Global.asax which is {controller}/{action}/{id} thus you get CourseCases/Index/9.

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

Sidebar

Related Questions

I'm trying to generate an Html.ActionLink with the following viewmodel: public class SearchModel {
I use the following ajax ActionLink method. @Ajax.ActionLink( , RemovePerson, General, new { PersonId
The following code generates an error: @Html.ActionLink(Title, action, new { id=1 }, new {
I am using the following: <img src=../../Content/Images/lock_16.gif /> @Html.ActionLink(Register, Register, Users, null, new {
I have the following Html: <%: Html.ActionLink(item.ProductName, Details, Product, new { item.ProductId }, null)%>
I use the following function to show controls on my form: class procedure TFormMain.FadeControls(ctrl:Array
I've got the following View <% Using Html.BeginForm()%> <%: Html.ValidationSummary(True) %> <div class=displayright> <h3>
I use the following LINQ to create grid model: ... var query = from
I have a simple question. I have the following html code <a href=# class=purchase>
I use following code : public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setTheme(android.R.style.Theme_Wallpaper); setContentView(R.layout.main); }

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.