Trying to create asp.net mvc view page without codebehind page

I am trying to create a browse page in my asp.net-mvc application. For this, I have a strongly typed view, and I also have the MVCPage class.

For some reason, when I load the page, it says that it cannot load the type:

<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" 
Line 2:  Inherits="Blah.MyViewPage<Blah.ViewDataForBLahPage>" %>

public class MyViewPage<TViewData> : ViewPage<TViewData> where TViewData : class 

public class ViewDataForBlahPage : MyViewData
+3
source share
6 answers

The code you posted is pretty confusing for me, so I'm not sure what happened. But this is how I make it work (i.e. Page without code):

<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<MyCustomViewModel>" %>

Replace MyCustomViewModelthe view model with your own class, as you mentioned that your view is a strict type view.

- , , , ...

0

System.Web.Mvc.ViewPage<Blah.ViewDataForBLahPage>
0

, , - MVC. , MVC .

0

?

ETA: ? ?

0

web.config, <pages/>. , MYBlah.Core .

0

, , , :

 Inherits="MYBlah.Core.MyViewPage<MyBlah.Core.ViewDataForUser>"

For .NET, the general class MyViewPageis different from MyViewPage<T>.

0
source

Source: https://habr.com/ru/post/1711421/


All Articles