All Questions
12
questions
4
votes
2
answers
6k
views
ASP.NET Core Razor Pages Model State Is Not Valid & Model data is empty
I am new to ASP.NET core razor pages & while practising I am facing a problem related to ViewModel Binding in Core2.1 Razor Pages. When I post form data then it shows ModelState is invalid with ...
0
votes
0
answers
508
views
Checking the ModelState OnPost of only the visible form's properties in razor pages
I created a razor page that has the following properties:
[BindProperty]
public CustomerViewModel Customer { get; set; }
[BindProperty]
public CustomerContactViewModel Contact { get; set; }
Within ...
0
votes
1
answer
2k
views
Making an AJAX request to a controller or page model with Razor Pages
With the addition of Razor Pages as an option for .net core I am a bit confused. I am aware that handlers can be used to call multiple actions of the same HTTP type. But what if I want to create an ...
3
votes
0
answers
2k
views
Getting Client-side validation to work
Situation: project created by dotnet new webapp
My Razor Pages page is working with server side validation, that is, ModelState is returning the correct value accordingly.
According to this, am I ...
1
vote
0
answers
206
views
How to render a specific view from a different PageModel file
From page1.cshtml.cs, how do I render the contents of page2.cshtml?
I am not looking for redirection as I don't want the url address to change.
3
votes
1
answer
3k
views
How to exclude layout?
My ASP.NET Core web project has the usual shared layout file.
How do I exclude the use of layout for a specific page?
1
vote
1
answer
459
views
How to use functions in asp-for attribute or @Html.EditorFor or @Html.TextBoxFor
I am developing MVC website in .Net Core 2.0. In this, I want ViewModel binding but, my ViewModel is of IEnumeration Type. When I want to use functions to in the tag i.e.
@Html.EditorFor(Model....
0
votes
1
answer
770
views
Razor pages custom routes
I am trying to get following routes so, i have the GlobalTemplatePageRouteModelConvention.
I used int? constraint to distinguish /1 from /ListJson handler but I am not happy with it, it is needlessly ...
7
votes
5
answers
17k
views
Inserting html tags between C# block code in cshtml file
I want to use html tags between C# block code, I've tried it but I got errors.
How can I insert html tags between C# block code in cshtml file?
The error is:
only assignment call increment ...
1
vote
1
answer
3k
views
How to load partial razor page into razor view
I am trying to replace my view components with razor pages but it seems that it's not possible to load a partial razor page because a model is expected to be passed yet it is my understanding that the ...
5
votes
4
answers
7k
views
Routing using ASPNET Core 2.0 RazorPages
I've done quite some ASP.NET API programming over the years, but am very new to .NET Core and RazorPages. I cannot seem to get routing working properly.
For example, I have an Index page. The OnGet ...
2
votes
2
answers
3k
views
Override razor views in asp.net core razor pages
In asp.net core mvc, I had multiple locations specified for the views. so, if view was missing in one location, it gets fetched from the other location.
I have a CMS with asp.net core mvc where ...