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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T00:34:04+00:00 2026-05-21T00:34:04+00:00

I asked this question here on the forum for static link helper, but I

  • 0

I asked this question here on the forum for static link helper, but I got no answers yet. So I decided to create my own helper.

I’m trying to create a helper for a static link

<a href='xx'>yy</a>

but is displaying the HTML code.

Using:

<div>
@Html.Link("www.google.com", "Google")
</div>

Result:

<a href="www.google.com">Google</a> 

See my class:

public static class BindHelper
{
    public static TagBuilder Link(this HtmlHelper helper, string targetUrl, string text)
    {
        TagBuilder imglink = new TagBuilder("a");
        imglink.MergeAttribute("href", targetUrl);
        imglink.InnerHtml = text;
        return imglink;
    }
}

How to create my own helper?
Already researched on several sites and some extended the method returns a string in the other class TagBuilder but both ways it displays the HTML code on page

  • 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-21T00:34:05+00:00Added an answer on May 21, 2026 at 12:34 am

    Return an MvcHtmlString. That is what MVC does internally. It (somewhat) implements IHtmlString which tells the HTML encoder not to reencode the value.

    Also add your namespace to the build configuration section of the web.config.

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

Sidebar

Related Questions

(I asked this question in another way , and got some interesting responses but
This question has been asked here before, but the author wasn't very clear and
I know this question has been asked many times, but here are my specific
This question has been asked here in one form or another but not quite
Introduction: I asked this question on the P2-forum already but I couldnt get any
I asked this question before, Here however I think I presented the problem poorly,
This question comes on the heels of the question asked here . The email
Liu Chang asked a very similar question to this one here, Linux equivalent of
This is in reference to the question previously asked The problem here is, each
Ok, i've read most relevant questions asked here previously on this but I still

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.