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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T12:24:54+00:00 2026-06-09T12:24:54+00:00

Problem No 1: I have started learning ASP.NET MVC. I have made a simple

  • 0

Problem No 1:

I have started learning ASP.NET MVC. I have made a simple extension method, like this:

namespace MvcTestz  //Project is also named as "MvcTestz"
{
  public static class SubmitButtonHelper //extension method.
  {
    public static string SubmitButton(this HtmlHelper helper,string buttonText)
    {
        return string.Format("<input type=\"submit\" value=\"{0}\">",buttonText);
    }
  }
}

Then I have added namespace of the Custom HtmlHelper in to the Web.Config ,like this

  <namespaces>
    <!--other namespaces-->
    <add namespace="MvcTestz"/>
    <!--other namespaces-->
  </namespaces>

So that I could use intellisense in the razor View ,but it custom Helper didnt showed up in one View (Home/View/About.cshtml).

enter image description here

So in another view (Home/View/Index.cshtml) I added namespace by @using MvcTestz; statement.

Problem No 2:

Upon WebApp execution Home page(Home/View/Index.cshtml) shows input button text without rendering it into HTML.

enter image description here
On the About page (Home/View/About.cshtml) sever generates error. (Click for Enlarged)
enter image description here

Update:

  1. Intellisense problem solved , I had to edit the Web.Config present in the View Directory. SOLVED.
  2. HtmlString Should be used if I want to render a Html button. SOLVED.
  • 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-09T12:24:55+00:00Added an answer on June 9, 2026 at 12:24 pm

    Problem 1:

    Razor namespaces should be registred in the <system.web.webPages.razor> node in web.config:

     <system.web.webPages.razor>
        <host factoryType="System.Web.Mvc.MvcWebRazorHostFactory, System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
        <pages pageBaseType="System.Web.Mvc.WebViewPage">
          <namespaces>
            <add namespace="System.Web.Mvc" />
            <add namespace="System.Web.Mvc.Ajax" />
            <add namespace="System.Web.Mvc.Html" />
            <add namespace="System.Web.Routing" />
            <add namespace="MvcTestz"/>
    
          </namespaces>
        </pages>
      </system.web.webPages.razor>
    

    Problem 2: Use HtmlString instead of string in your helper:

    public static HtmlString SubmitButton(this HtmlHelper helper, string buttonText)
    {
        return new HtmlString(string.Format("<input type=\"submit\" value=\"{0}\">", buttonText));
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Just started learning PySide and is having problem with QTimer I have this #!/usr/bin/python
I've started learning C++. Here's my simple problem. I have a code: int main()
I am a newbie and just started learning the asp.net mvc, as I was
I have just started learning Spring MVC 3 and I have problem right at
I have started learning Java and am having problem with a simple program that
I've started learning JSF2.0, and have come across a problem. Any advice on how
I have started learning MVC2. I developed a simple customer search screen with Jquery
I have started learning perl and like to try out new things. I have
I've started learning about image processing in Matlab and I have a small problem.
I just started learning C++ couple of weeks ago. So now I have this

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.