i created a blazor project, and added the MVC Models, Views, Controllers folders. and registered the routing at startup.cs. and all seems to work fine when navigating the urls. (usually this is done the other way around, by starting with a MVC project, and
installing blazor, but this seems more complicated to me?)
unfortunately, im comming from web forms, and never seen razor syntax before. and i dont understand how to use blazor in MVC from here on.
is it possible to use blazor C# on the Views? or do i need to frame .razor files inside the views? and can i put .Razor files in the "\Views\Home" Folder or does it only work in the \Pages folder?
You wouldn't normally mix Blazor with MVC Views. It is possible to render a Blazor Component in MVC view, but you would only really do that if you had a killer Blazor component and no standard MVC-enabled alternative. That is highly unlikely unless you get
a really expensive commercial component, and even then, The Blazor versions are likely to be based on existing MVC components.
If coming from Web Forms, your first decision is whether to use MVC, Razor Pages or Blazor. in my opinion. And to answer that, you need to understand each of them. You should work through some examples of each without mixing them up and causing yourself
unnecessary complexity and confusion.
Member
5 Points
167 Posts
is it possible to use blazor C# on the MVC View cshtml instead of .razor files?
Jul 19, 2020 06:59 PM|fazioliamboina|LINK
i created a blazor project, and added the MVC Models, Views, Controllers folders. and registered the routing at startup.cs. and all seems to work fine when navigating the urls. (usually this is done the other way around, by starting with a MVC project, and installing blazor, but this seems more complicated to me?)
unfortunately, im comming from web forms, and never seen razor syntax before. and i dont understand how to use blazor in MVC from here on.
is it possible to use blazor C# on the Views? or do i need to frame .razor files inside the views? and can i put .Razor files in the "\Views\Home" Folder or does it only work in the \Pages folder?
All-Star
194865 Points
28100 Posts
Moderator
Re: is it possible to use blazor C# on the MVC View cshtml instead of .razor files?
Jul 20, 2020 03:01 PM|Mikesdotnetting|LINK
You wouldn't normally mix Blazor with MVC Views. It is possible to render a Blazor Component in MVC view, but you would only really do that if you had a killer Blazor component and no standard MVC-enabled alternative. That is highly unlikely unless you get a really expensive commercial component, and even then, The Blazor versions are likely to be based on existing MVC components.
If coming from Web Forms, your first decision is whether to use MVC, Razor Pages or Blazor. in my opinion. And to answer that, you need to understand each of them. You should work through some examples of each without mixing them up and causing yourself unnecessary complexity and confusion.