Skip to main content
Filter by
Sorted by
Tagged with
0 votes
0 answers
81 views

I'm using data annotations from System.ComponentModel.DataAnnotations in my ASP.NET project. I get an error message where you can describe the requirements such as "Name is required" and etc....
DELI's user avatar
  • 11
1 vote
1 answer
93 views

I created a custom validation attribute: [AttributeUsage(AttributeTargets.Property, AllowMultiple = false)] public class MinByteLengthAttribute(string lengthPropertyName) : ValidationAttribute { ...
Ivan Debono's user avatar
  • 1,018
1 vote
1 answer
66 views

I would like to define a class for different strings which Entity Framework Core will recognise and apply certain rules without data annotations. For instance I would like to replace the following ...
Corey Jensen's user avatar
1 vote
0 answers
25 views

I have this field, EXP_DEL_DATE, which is defined in a class as follows : [BindProperty] [Required(ErrorMessageResourceType = typeof(MsgsResource), ErrorMessageResourceName = MandatoryFld)] [...
Ryan Ong's user avatar
2 votes
0 answers
114 views

I'm working on an ASP.NET Core Minimal API. We are using the MiniValidation library for request validation on our endpoints. We have some strict linting that means for reference types we need to ...
rcarrington's user avatar
  • 1,722
1 vote
1 answer
56 views

I'm working with a Blazor web assembly project, but having an issue while submitting form after inputting email and password still asking for email and password Email is required Password is required ...
Uddyan Semwal's user avatar
0 votes
1 answer
72 views

Here's my custom validator: public class CustomRuleFileTypeAttribute : ValidationAttribute { protected override ValidationResult IsValid(object value,ValidationContext validationContext) ...
bbWebDev's user avatar
0 votes
2 answers
106 views

I have a new .NET 9 Razor page Blazor server-side project. I used EF Core Power Tools to import my database schema and generate the DbContext and model classes. I created a MetaData class for one of ...
StuartV's user avatar
  • 135
0 votes
1 answer
59 views

I'm trying to get data annotations validation messages in Portuguese (pt-BR) but they remain in English even after setting the culture. Here's what I've tried - in Program.cs: var builder = ...
Max Bündchen's user avatar
2 votes
1 answer
165 views

I would like to know if there is a way to export a data frame/tibble from R as an .xlsx file with highlighting and comments added natively from the R console rather than post-processing in Excel. I ...
user2352714's user avatar
0 votes
1 answer
66 views

Here's a model class (generated by scaffolding, nothing changed): using System; using System.Collections.Generic; using System.ComponentModel; using System.ComponentModel.DataAnnotations; namespace ...
J. Barrett's user avatar
1 vote
1 answer
514 views

I have read many topics on how to change the default error message language for form validation, but none are applicable to Net 8 with Razor pages (no MVC). My situation is a webapp in C# with razor ...
Giorgio F.'s user avatar
1 vote
1 answer
134 views

I have a simple model called FooModel that has a single string property called Text. I am attempting to use DataAnnotationsValidator to validate a collection of Models that are dynamically added to ...
Gabe's user avatar
  • 50.7k
0 votes
1 answer
102 views

I want mask my images with json formats as data for training model of u net. I use this below code to mask them: import json import numpy as np import cv2 import os # Path to the folder containing ...
user avatar
0 votes
1 answer
81 views

I have a dataset annotated by three people, so now I have three files. This dataset is about tweets annotation. How can I combine this dataset into one file for further processing. The data set is an ...
ZAIN UL ABIDIN QADRI's user avatar
1 vote
2 answers
204 views

I have this model: using System.ComponentModel.DataAnnotations.Schema; using Microsoft.EntityFrameworkCore; using MyProject.Class.Dto; namespace SageApi.Model; public partial class FArticle { ...
Lenny4's user avatar
  • 1,756
0 votes
1 answer
277 views

I have a model class in .NET 6.0 and applied data annotations. I have extension class ApiRequestValidation that returns validationresults after checking the JSON in the request body. using System....
PavanKumar GVVS's user avatar
0 votes
0 answers
73 views

My web api has 3 layers: Controller, Service Layer, and Repository. This is accessed via a SPA. Imagine the scenario where you have a form in the SPA that takes the First Name and Last Name and sends ...
Qiuzman's user avatar
  • 1,843
0 votes
0 answers
92 views

I have a class Detail with a parameter of type List<string> public class Detail { public int index { get; set; } [MaxLength(50)] [RegularExpressionList("^[a-zA-Z0-9א-ת@/\\.\\- !@...
Nir Amir's user avatar
0 votes
0 answers
96 views

I have previously been tasked with trying to submit json data and files to a web api shown here in this problem. The issue is I do not want to create a custom model binder for every instance this ...
Qiuzman's user avatar
  • 1,843
0 votes
2 answers
849 views

I'm trying to get automatic data validation working in an ApiController but when the user sends incorrect/missing data a JSON deserialization failed error message is returned instead of the custom ...
iKingNinja's user avatar
1 vote
2 answers
515 views

I'm trying to localize error messages for data annotations attributes. I created two resx-files: DataAnnotationsLocalization.resx > DataAnnotationsLocalization.Designer.cs ...
Yola's user avatar
  • 19.4k
0 votes
1 answer
47 views

I have 4 checkboxes in my form and want user to select at least one of the checkbox when form is submitted. I am using ExpressiveAnnotations.Attributes; reference as we use this in other part of ...
Jay's user avatar
  • 1,039
1 vote
1 answer
131 views

I wrote a custom DataAnnotations validator (for client and server): public class CustomAttribute : ValidationAttribute, IClientModelValidator { /* ... */ } However the docs show an alternate approach,...
lonix's user avatar
  • 22.5k
0 votes
2 answers
44 views

I have a property with StringLength attribute, but I can assign a string of any length to this property. I created the following test program in VB.NET 4.7 Framework: Imports System.ComponentModel....
Alex's user avatar
  • 561
0 votes
0 answers
100 views

I have various config values defined in the database or appsettings. But those cannot be used in DataAnnotation attributes (which require compile-time constants), so everything is duplicated in a ...
lonix's user avatar
  • 22.5k
0 votes
1 answer
612 views

I have an appsettings.json with the following contents: { "Settings": { "Greeting": "Hello World" } } that I associate with public sealed class ...
user23207089's user avatar
7 votes
2 answers
5k views

I am porting an application from Asp.net Controllers to Asp.net Minimal-Apis. The current project is using model-based DataAnnotations. Controllers do model validation out of the box but MinApi does ...
WillC's user avatar
  • 2,265
1 vote
2 answers
1k views

In the handleSubmit-function of a Blazor CRUD component, I have to provide an error message that is based on the DataAnnotation MaxLength-attribute. I would like to show a "custom" C# error ...
John D's user avatar
  • 701
1 vote
1 answer
134 views

The idea is to make use of the default messages for fast development of apps and for cleaner code, but I couldn't figure out a way to do it. This is how far I got: // Program.cs: using ... var builder ...
mikl's user avatar
  • 1,027
0 votes
1 answer
170 views

I have situation when I have 2 pods that getting requests to update status of object lets call him user, he have 3 statuses : new, verified and failed. they getting in parallel the entity with status ...
Napa's user avatar
  • 1
1 vote
0 answers
43 views

Problem: I wrote derived class from DataAnnotation.StringLengthAttribute attribute that allows exact number of characters instead of Min/Max. enter image description here My string: enter image ...
THE NORMAL's user avatar
0 votes
1 answer
154 views

I have a huge number of images that have human. after a ran Yolov8 on them, all resulted labels are class 0 "person" I want to change to 3 classes class 0 "man", class 1 "...
Nada 's user avatar
1 vote
1 answer
81 views

I can find plenty of information on Regular Expressions for .NET, but not specifically for the RegularExpression attribute. From what I can see, it behaves differently than normal .NET RegEx. I am ...
David.Warwick's user avatar
0 votes
1 answer
50 views

I have a IdSeqAttribute: [AttributeUsage(AttributeTargets.Class, AllowMultiple = false, Inherited = false)] public class IdSeq(string seq) : Attribute { public string Seq = seq; } and use it like ...
Rodolfo's user avatar
  • 71
1 vote
0 answers
264 views

I use fluent validation for client side validation of my mudform: <MudBlazor.MudForm Model="person" @onsubmit="ValidSubmit" @ref="frmMain" @bind-...
mz1378's user avatar
  • 2,642
-2 votes
2 answers
97 views

I need a regular expression for a URL-friendly slug, which can only contain lowercase letters and hyphens. It can't start or end with a hyphen and can't have more than one consecutive dash. It will be ...
Kenneth R. Jones's user avatar
2 votes
1 answer
296 views

I don't understand why in an asp.net 7.0 razor pages application the localization of data annotations error messages works for all attributes except for the "DataType" attribute where the ...
steve fax's user avatar
0 votes
1 answer
114 views

What's changed? I've had this C# Razor app (SQL backend) developed and deployed in production for 3 years now. Recently, I've added 3 new tables in SQL and rather than use Package Manager console to ...
GCDevOps's user avatar
1 vote
1 answer
92 views

I would like to disable data annotation validation for some case. You assume that we have two DTO and two endpoint public class CreateBulkProductDto { [Required] public List<...
CaglarAyhan's user avatar
0 votes
0 answers
84 views

I set attribute to benefitID to [Column(TypeName="varchar(10)")] but when I run it benefit is nvarchar(450). [Key] [Column(TypeName="varchar(10)")] [StringLength(20)] [Required] ...
Chiến Trần's user avatar
1 vote
1 answer
418 views

I am working on tightening up the password on my site, and wanted to see if I can use the MembershipPassword? I have tried to use the code below in my model but I am not getting any error message. ...
Jefferson's user avatar
  • 121
0 votes
0 answers
36 views

I just wanted to be able for a user to select from a dropdown if their id number was a ssn or ein. I created a Farm entity and I wanted the user to select from a dropdown using Datalist whether or not ...
Christopher Blick's user avatar
-1 votes
2 answers
128 views

When I set value from server side to prop has a validation attribute "MaxLength", the application not throw exception. public class Student { public Guid Id { get; set; } ...
Mahmoud Alakrami's user avatar
3 votes
0 answers
905 views

What exactly is the difference between these two .NET attributes: [PasswordPropertyText] => PasswordPropertyTextAttribute [DataType(DataType.Password)] => DataTypeAttribute with a DataType ...
Alexandra Valkova's user avatar
0 votes
0 answers
270 views

I have gone through quite a bit of SO questions like: Localise Display DataAnnotation without the Name Attribute in .NET Core 5 ViewModel Display Name is problem on Data Annotation ErrorMessage (The {...
Shankar's user avatar
  • 1,666
0 votes
0 answers
21 views

I have a list of objects for my ASP.NET MVC model List<NameAddressModel>. In this abbreviated example, we're only looking at the first name. The model has the [Required] attribute, which will ...
NovaDev's user avatar
  • 2,971
1 vote
1 answer
403 views

I have a Blazor server app that has a form with two password inputs, "new password" and "confirm password". I'm using DataAnnotations Compare attribute to validate that the two ...
Boatmarker's user avatar
0 votes
1 answer
588 views

I am migrating a project from ASP.NET MVC to ASP.NET Core 6.0. I have the following class in the ASP.NET MVC project: public class CustomModelMetadataProvider : DataAnnotationsModelMetadataProvider { ...
csharpdev's user avatar
0 votes
1 answer
97 views

I have a list of plant organisms (text) and I want to annotate them with ontologies(Plant ontology, Crop Ontology, Food Ontology, etc), I was using ontology lookup services to do the annotation ...
Agnes's user avatar
  • 1

1
2 3 4 5
61