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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T07:41:54+00:00 2026-05-27T07:41:54+00:00

I have created a Helper method in MVC3 Razor project as(Helpers.cshtml) @helper Link(string fileName,

  • 0

I have created a Helper method in MVC3 Razor project as(Helpers.cshtml)

   @helper Link(string fileName, UrlHelper url){
        <link href="@url.Content("~/Content/" + fileName)" 
              rel="stylesheet" type="text/css" />
   }

But i get a warning tooltip “Element link cannot be nested within element ‘link'”.

I found similar type of question on Asp.net
Error when using link href inside my ContentPlaceHolder

Do we have a solution for 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. Editorial Team
    Editorial Team
    2026-05-27T07:41:55+00:00Added an answer on May 27, 2026 at 7:41 am

    Keep in mind that you should only have <link> tags in the <head> and not the <body>. The tooling is unable to confirm from where you’ll call this helper, so it barks.

    You can verify that this is what’s going on by temporarily wrapping the helper in a valid skeleton of markup as below. The warning should go away. You can then confirm the negative case by changing link to some made-up tag like foo, or by removing the title, and watch those errors then appear. You should then be comfortable that as long as you only call your helper from inside <head> sections, your resulting link markup is ok.

    <html>
    <head>
        @helper Link(string fileName, UrlHelper url){
            <link href="@url.Content("~/Content/" + fileName)" rel="stylesheet" type="text/css" />
       }
       <title>Foo</title>
    </head>
    <body></body>
    </html> 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have created a helper method for generating a li content tag with a
I have a long form to test, so I created a CompleteForm() helper method
I have created a helper method in view like this: @helper DisputeOpenedDays(DateTime createdDate) {
Inside a Webservice method , i have created a helper class whose responsibility is
I have created a custom dialog for Visual Studio Setup Project using the steps
i have created my own Zend_Form class currently just to add some helper functions
For collection of smaller helper utility classes, I have created a general class MyUtils
I have created a method like NUnit's Throws method. Basically, the method should return
I have following helper method: def orders_chart_series(orders, start_time) orders_by_day = orders.where(:created_at => start_time.to_date..Date.today). group(date(created_at)).
How can I make a MVC3 Html helper return a string which is not

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.