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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 10, 20262026-05-10T19:47:15+00:00 2026-05-10T19:47:15+00:00

In ASP.NET MVC, I’m trying to create a link that includes an anchor tag

  • 0

In ASP.NET MVC, I’m trying to create a link that includes an anchor tag (that is, directing the user to a page, and a specific section of the page).

The URL I am trying to create should look like the following:

<a href='/category/subcategory/1#section12'>Title for a section on the page</a> 

My routing is set up with the standard:

routes.MapRoute('Default', '{controller}/{action}/{categoryid}');  

The action link syntax that I am using is:

<%foreach (Category parent in ViewData.Model) { %> <h3><%=parent.Name %></h3> <ul> <%foreach (Category child in parent.SubCategories) { %>     <li><%=Html.ActionLink<CategoryController>(x => x.Subcategory(parent.ID), child.Name) %></li> <%} %> </ul> <%} %> 

My controller method is as follows:

public ActionResult Subcategory(int categoryID) {    //return itemList     return View(itemList); } 

The above correctly returns a URL as follows:

<a href='/category/subcategory/1'>Title for a section on the page</a> 

I can’t figure out how to add the #section12 part. The ‘section’ word is just the convention I am using to break up the page sections, and the 12 is the ID of the subcategory, i.e., child.ID.

How can I do this?

  • 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. 2026-05-10T19:47:16+00:00Added an answer on May 10, 2026 at 7:47 pm

    I would probably build the link manually, like this:

    <a href='<%=Url.Action('Subcategory', 'Category', new { categoryID = parent.ID }) %>#section12'>link text</a> 
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 68k
  • Answers 68k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • added an answer http://msdn.microsoft.com/en-us/library/bb200105.aspx#ID2EWD Looks like you'll need to use Microsoft.Xna.Framework.Storage and the… May 11, 2026 at 12:20 pm
  • added an answer Thanks for all the answers and help guys... I'm actually… May 11, 2026 at 12:20 pm
  • added an answer It is taking the culture you gave and applying the… May 11, 2026 at 12:20 pm

Related Questions

In ASP.NET MVC, I'm trying to create a link that includes an anchor tag
I'm creating a small app in ASP.NET MVC that generates ics (iCal) files based
I'm building a CMS in ASP.NET MVC and want to allow users to pick
In looking at samples of ASP.NET MVC sites, I'm seeing quite a bit of
When using the Ajax.BeginForm() helper in ASP.Net MVC , I can pass options with

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.