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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T05:54:56+00:00 2026-06-04T05:54:56+00:00

Pretty new to ASP.NET and trying to figure out how to have the code

  • 0

Pretty new to ASP.NET and trying to figure out how to have the code just echo the information it fetched.

<ul class="accordion">
    <% foreach (var cat in Model.Categories.Where(x=>x.ParentId==null).OrderBy(x=>x.DisplayOrder).ThenBy(x=>x.CategoryName)) { %>
        <li style="height: auto; min-height:30px;">
            <%= Html.ActionLink(cat.CategoryName, "Index", "Products", new { id=cat.UniqueName, area="" }, null)%>

            <%if(cat.SubCategories.Count>0) {%>
                <ul class="sub-menu" style="font-size:.8em; padding-left:20px;">
                    <% foreach (var c in cat.SubCategories) { %>
                        <li><%= Html.ActionLink(c.CategoryName, "Index", "Products", new { id=c.UniqueName, area="" }, null)%></li>
                    <% } %>
                </ul>
            <%}%>
        </li>
    <%} %>
</ul>

Currently I know it has to do with <%= Html.ActionLink(cat.CategoryName, "Index", "Products", new { id=cat.UniqueName, area="" }, null)%> that line but not sure how to make it pass the information. Might be a stupid question but Google definitely did not help when searching for this answer.

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-04T05:54:57+00:00Added an answer on June 4, 2026 at 5:54 am

    Here is a brief overview of some of the commands:

     <%= Html.ActionLink(cat.CategoryName, "Index", "Products", new { id=cat.UniqueName, area="" }, null)%>
    

    Will create:

     <a href="products/index/{UniqueName}">{CategoryName}</a>
    

    Which can also be constructued as:

     <a href="<%= Url.Action("Index", "Products", new { id=cat.UniqueName, area="" })%>"><%: cat.CategoryName%></a>
    

    Which will also create:

     <a href="products/index/{UniqueName}">{CategoryName}</a>
    

    So, you can output just the name or ID using:

     <%: cat.CategoryName %>
    

    OR

     <%= cat.CategoryName %>
    

    <%= is “Response.Write” and “<%:” Is Response.Write with HTML Encode

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

Sidebar

Related Questions

I'm pretty new to Silverlight/RIA/Asp.Net thing, and I'm trying to figure if an Asp.Net
I am new to ASP.NET MVC and I have been able to figure pretty
I'll admit, I am pretty new with ASP .NET programming and I have been
I'm pretty new in ASP.net, and im trying to validate some output from my
I'm pretty new to Asp.net so sorry if this is elementary. I'm trying to
Note: The following is just an example. I'm pretty new to ASP.NET MVC and
I'm still pretty new to asp.net web forms. I have a requirement to make
I'm pretty new to asp net 2.0 programming and I was wondering how can
I'm pretty new to ASP.NET MVC and I hope it is not a too
I am pretty new to database design. I am building a small asp.net mvc

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.