Adding new plugin problem

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
11 years ago
Hello
I created a new plugin but when i try to access the url , it gives me this error

The view at '~/Views/Article/IMC.Plugin.Frational.Article.Views.Article.Index2.cshtml' must derive from WebViewPage, or WebViewPage<TModel>.

what is this error

Modal Class
namespace Nop.Plugin.Frational.Article.Models
{
    public class ArticleModel : BaseEntity
    {

        public virtual int Id { get; set; }
        public virtual string Title { get; set; }
        public virtual string Description { get; set; }
        public virtual string Body { get; set; }
        public virtual DateTime CreationDate { get; set; }
        public virtual bool IsPublished { get; set; }
    }
}



Controller Class

namespace Nop.Plugin.Frational.Article.Controllers
{
    public class ArticleController : Controller
    {
        public ActionResult Index()
        {
            ArticleModel modal = new ArticleModel();
            modal.Title = "test";
            return View("Nop.Plugin.Frational.Article.Views.Article.Index", modal);
        }

      
    }
}




Provider Class

namespace Nop.Plugin.Frational.Article
{
    public class ArticleProvider : BasePlugin
    {
        public override void Install()
        {
            base.Install();
        }
    }
}



RoutProvider Class


namespace Nop.Plugin.Frational.Article
{
    public class RouteProvider : IRouteProvider
    {

        public void RegisterRoutes(RouteCollection routes)
        {
            routes.MapRoute("ArticleRout", "Article/Index",
                           new { controller = "Article", action = "Index" },
                           new[] { "Nop.Plugin.Frational.Article.Controllers" });
        }

        public int Priority
        {
            get { return 0; }
        }
    }
}


View is under Views/Article/


@using Nop.Plugin.Frational.Article.Models
@model ArticleModel
@{
    Layout = "~/Views/Shared/_ColumnsTwo.cshtml";
}

<table class="adminContent">
    <tr>
        <td>
                  bla bla bla
        </td>
    </tr>
</table>



Update
when i edit controller to return Content "not the view " it worked perfectly


namespace Nop.Plugin.Frational.Article.Controllers
{
    public class ArticleController : Controller
    {
        public ActionResult Index()
        {
            ArticleModel modal = new ArticleModel();
            modal.Title = "test";
           // return View("Nop.Plugin.Frational.Article.Views.Article.Index", modal);
            return Content("Test ");
        }

      
    }
}


Any body have any idea how to return a view instead of content
11 years ago
I managed to fix the problem,
I were reference system.web.mvc version 4 I removed it and
added reference to system.web.mvc version 3 and everything worked fine :D
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.