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