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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T00:53:24+00:00 2026-05-18T00:53:24+00:00

I am trying to refactor my views a bit and up til now i

  • 0

I am trying to refactor my views a bit and up til now i have been using the built HTML helpers but i thought i would create my own – they’re extension methods right?

I wonder if anyone can confirm or give advise when an HTML is needed? I think i once saw a document that said if you use 1 IF statement in your views encapsulate it into a html helper – would anyone agree with that?

With regards to creating html helpers, would it be better to create my own class rather than add extension methods to the HTML class that ships with MVC? Any body have ideas on this?

Or possible i shouldn’t bother with HTML helpers and just use the built in ones and continue to use my IF statements within views.

Thanks in advance

  • 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-18T00:53:25+00:00Added an answer on May 18, 2026 at 12:53 am

    Use HTML helpers when you want to encapsulate the output of a piece of HTML markup that can take varying values.

    I’d recommend creating them as extension methods to HtmlHelper rather than creating your own class, as your own class won’t be available inside of the default ViewPage without either instantiating a new instance inside of the View or subclassing ViewPage and using this in the View (or passing in on the model, but that’s just wrong!).

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

Sidebar

Related Questions

I have some debugging functions that I would like to refactor, but seeing as
I am trying to refactor out my application a little bit to keep it
I have the following code for adding to/extracting from Zip. I'm trying to refactor
I'm trying to refactor an old web service project using new structure (with Maven)
I am trying to refactor my package using Eclipse org.sheehan.activity to org.sheehan.stocks.activity For some
I currently have some code I am trying to refactor. A large set of
I'm trying to refactor this algorithm to make it faster. What would be the
I'm trying to refactor this code. I have this jquery ajax call $.ajax({ url:
I have repetitive code that i am trying to refactor into a generic function
I'm trying to refactor a component that currently produces a Seq[X] using a fairly

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.