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).

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.

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

Update:
- Intellisense problem solved , I had to edit the Web.Config present in the View Directory. SOLVED.
HtmlStringShould be used if I want to render a Html button. SOLVED.
Problem 1:
Razor namespaces should be registred in the
<system.web.webPages.razor>node in web.config:Problem 2: Use
HtmlStringinstead of string in your helper: