Skip to main content

All Questions

Tagged with
0 votes
2 answers
56 views

Form in foreach in Razor view: Validation is shown to all the elements

Consider the following Razor code foreach(Person p in Model.Persons){ <form> @Html.TextBoxFor(m => p.Name) @Html.ValidationMessageFor(m => p.Name) @Html....
Alessandro's user avatar
0 votes
0 answers
66 views

Preventing Duplicate Tabs in Blazor WebAssembly

I'm working on a Blazor WebAssembly application and encountering an issue where the same page can be opened in multiple tabs if the user either copies the URL or modifies the link in the browser. I ...
neha's user avatar
  • 65
0 votes
1 answer
49 views

display errors in form from a controller base

I have implemented a login form that utilizes the login controller, which serves as a base controller. While the controller functions properly, my concern lies with error handling. Regrettably, I am ...
Lemon Grab's user avatar
2 votes
1 answer
66 views

What is the most appropriate default string value for a [Required] data annotation? [closed]

I'm learning model binding and validation for C# .NET 8 Razor Pages. I set up a simple input model to test validation (from ASP.NET Core Razor Pages in Action, Mike Brind): public class ...
canyon's user avatar
  • 33
0 votes
2 answers
771 views

Runtime Compilation of Razor Pages Does Not Work .NET 8 VS2022

I am having a hard time enabling runtime compilation of Razor pages under IIS v10.0, using Visual Studio 2022 17.8.8, .NET 8.0.103 (Windows 11). I have followed the instructions at https://learn....
Optimax's user avatar
  • 1,584
0 votes
1 answer
117 views

.Net 8 Blazor Web App how to map nonexisting urls to <NotFound> element

This is an Interactive WebAssembly Blazor Web app. When user click a link which a nonexisting url, I want the app goes the <NotFound> Element setup in the <Router>: The link like this: <...
KaraNoKara's user avatar
0 votes
0 answers
47 views

C# CheckBoxFor stopped rendering the hidden field

@Html.CheckBoxFor is not rendering a hidden input when it renders the checkbox input. Everything I have seen online indicates that the CheckBoxFor helper always renders 2 elements. Today... out of the ...
J_sdev's user avatar
  • 346
0 votes
0 answers
38 views

Error when loading Nuget packages in ASP.NET projects "Unable to load the service index for source https://api.nuget.org/v3index.json"

Im trying to follow the steps to make the ContosoUniversity project on https://learn.microsoft.com/fr-fr/aspnet/core/data/ef-rp/intro?view=aspnetcore-6.0&tabs=visual-studio. When i try to scaffold ...
Mich95194yet's user avatar
0 votes
1 answer
112 views

Configure Navbar with 2nd level

Probably an easy question, but I am pretty new to this and do not get it to work so far. Can someone tell me how I can make it work that "Location A" and "Location B" are only ...
deputy-chief-hardy's user avatar
0 votes
2 answers
67 views

I don't understand why my layout doesn't show

I'm new to .NET programming and I'm having trouble applying a Shared Layout to a blog page. My project contains the following files: enter image description here I've created a file named _Layout in ...
Lorine Monfils's user avatar
0 votes
1 answer
44 views

jQuery/Ajax form automatically submitting even though I have event.preventDefault in the submit action

I have an existing form that uses Ajax and jQuery. I'm trying to prevent it from automatically submitting and I've put event.preventDefault() in the submit action: $(document).ready(function () { ...
Tom's user avatar
  • 31
0 votes
1 answer
200 views

Filepond with .Net Razor Pages

I am trying to use Filepond to help with our site's file uploads. We wanted to add the ability for users to upload multiple files in part of their form submission but also to not handle the files ...
Adam Evans's user avatar
0 votes
1 answer
57 views

.NET Core Razor - scenario on how to mix C# with html

How to I escape the div tags inside my C# if condition so that the compiler accepts the syntax? I'm trying to start a new column of checkboxes when more than 4 to display. I'm adding a C# if condition ...
Bill's user avatar
  • 1,111
1 vote
1 answer
433 views

How to use HttpClient in a Razor component?

I want to create a Blazor component library for my Microservice app and I have an issue on the login.razor component : @inject NavigationManager NavigationManager @inject HttpClient HttpClient @inject ...
Clément GRANDGIRARD's user avatar
0 votes
1 answer
127 views

How to add new SelectListItem dropdown in Razor

What would be the most ideal way to add a new SelectListItem dropdown option based on a button click. Whay would be best practice? I've considered the following options and wondered whether they would ...
marcusredbie's user avatar

15 30 50 per page
1
2 3 4 5
8