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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T17:06:19+00:00 2026-05-25T17:06:19+00:00

I want to specify the html id in ActionLink , but I can’t do

  • 0

I want to specify the html id in ActionLink, but I can’t do this:

@html.ActionLink("Controller", "Action", new {@id = "tec"})

because the @id means that tec is a value of id parameter.

On the other hand, if I do

@html.ActionLink("Controller", "Action", new {@class = "tec"})

the result will be:

<a href="Controller/Action" class="tec"></a>

Do you know a way to specify the html id?

I wanna this result:

<a href="Controller/Action" id="tec"></a>
  • 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-05-25T17:06:19+00:00Added an answer on May 25, 2026 at 5:06 pm

    You have to specifiy also the controller and you can remove the @ before id

    @Html.ActionLink("mylink", "Action", "Controller", new {id = "tec"})
    

    That’s because the signature you are using is not the one relative to HtmlAttributes, but to the routing values. If you do not want to specify the controller, use this

    @Html.ActionLink("mylink", "Action", null, new {id = "tec"})
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Let's say that I want to specify Arial in the HTML header - and
I want to specify that for horizontal content it should be overflow:hidden but for
I have my html table, and I want to specify the height of each
Is there a way to specify pretty-print-like formatting around HTML tags? I want to
I want to specify that either fieldname or freetext must always be present in
I have a Java WebStart application for which I want to specify that the
Can I specify I want the preceding character to be either (NOT A DIGIT)
I have a question that has pretty much been asked here: asp.net mvc Html.ActionLink()
I'm creating an html form that will allow a user to specify a variable-length
I am using HTML::TreeBuilder to parse some HTML. Can you specify multiple classes in

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.