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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T02:13:18+00:00 2026-05-27T02:13:18+00:00

Im creating a custom field in MVC3 (C#) that I would like to access

  • 0

Im creating a custom field in MVC3 (C#) that I would like to access with the Html property in the views. I want to put it in its own class so that I can nicely organize code (private methods etc) because our current Html Extensions class is far too noisy.

This is what I’m looking for:

ex. @Html.CustomField...

Currently, I have this code:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using Matrix.Investigator.Models.Parties;
using Matrix.Investigator.Website.Extensions;

namespace Matrix.Investigator.Website.Fields
{
  public static class DetailsField
  {
    public static MvcHtmlString PartyDetailsField(this HtmlHelper helper, IEnumerable<IDetailsConfiguration> configuation)
    {
      .
      .
      .

      [Some Code for the field]

      return MvcHtmlString.Create([CODE FOR TAG].toString());
    }
  }
}

Anyway, when I attempt to use this on the form it doesn’t come up in intellisense:

ex: <li>@Html.PartyDetailsField(Model.IdentifierConfiguration)</li>

However, when the same code is placed in the HtmlHelperExtensions file, it works just fine. I do not even see a difference in the class definition.

Is there any light that can be shone on this situation OR am I going to have to leave it in the HtmlHelperExtensions class.

  • 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-27T02:13:19+00:00Added an answer on May 27, 2026 at 2:13 am

    Make sure you have brought the namespace in which this extension method is defined into scope in your view:

    @using Matrix.Investigator.Website.Fields
    

    or in the <namespaces> tag of your ~/Views/web.config (not ~/web.config) to bring it into scope globally in all your Razor views.

    Obviously due to crapiness of Intellisense of Visual Studio in Razor pages you might need to close and reopen your view in order for it to pick it. Anyway never trust Intellisense of Visual Studio in views. Trust your intuition and knowledge. Running the application is the best way to verify the result.

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

Sidebar

Related Questions

I want to create a custom field type (MyCompLookup) that will be used in
I am creating custom html helper for my datepicker. i want to pass inside
How would one go about creating a custom form field type for Symfony 2?
I'm using MVC3 and I would like to make my views be fully integrated
I'm creating some custom work items in TFS and the helptext field seems handy
I'm writing a custom field for Sitecore and I want a list box. Interestingly,
Is there a way to create a custom field that has multiple input elements?
I'm looking at creating a custom membership provider in ASP.Net MVC3 and am struggling
Yeah. As the title says, I am tasked with creating custom field in user
I am currently creating a custom e-commerce site (in php, but that's not really

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.