Search code examples
c#asp.net-mvcvisual-studiositefinity

Sitefinity; Html.BeginFormSiteFinity – namespace error


I am going through tutorials during 30-day evaluation (for Sitefinity, video).

My code:

@using Telerik.Sitefinity.UI.MVC
@using Telerik.Sitefinity.Mvc

@model SitefinityWebApp.Mvc.Models.BugModel

<h1>Create a Bug</h1>
@*@using (Telerik.Sitefinity.UI.MVC.SitefinityExtensions.BeginFormSitefinity(Html, "CreateBug", "BugForm"))*@ // Working.

@using (Html.BeginFormSiteFinity("CreateBug", "BugForm")) // Not work.
{
    @Html.EditorForModel()

    <input type="submit" value="save" />
}

Log

Type : System.Web.HttpCompileException, System.Web, Version=4.0.0.0,     Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
Message : c:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET     Files\vs\ca986f6c\ff192673\App_Web_bugform.cshtml.4a4b4012.cgfwcwbq.0.cs(63):     error CS1061: 'System.Web.Mvc.HtmlHelper<SitefinityWebApp.Mvc.Models.BugModel>'     does not contain a definition for 'BeginFormSiteFinity' and no extension method     'BeginFormSiteFinity' accepting a first argument of type 'System.Web.Mvc.HtmlHelper<SitefinityWebApp.Mvc.Models.BugModel>' could be found     (are you missing a using directive or an assembly reference?)

What is wrong?


Solution

  • In your case problem is that you misspelt BeginFormSiteFinity it should be BeginFormSitefinity. The correct version of your code is:

    @using Telerik.Sitefinity.UI.MVC
    @using Telerik.Sitefinity.Mvc
    
    @model SitefinityWebApp.Mvc.Models.BugModel
    
    <h1>Create a Bug</h1>
    @*@using (Telerik.Sitefinity.UI.MVC.SitefinityExtensions.BeginFormSitefinity(Html, "CreateBug", "BugForm"))*@
    
    @using (Html.BeginFormSitefinity("CreateBug", "BugForm"))
    {
        @Html.EditorForModel()
    
        <input type="submit" value="save" />
    }