Click here to Skip to main content
15,883,606 members
Home / Discussions / C#
   

C#

 
GeneralRe: System.Data.SQLite.SQLiteException: 'SQL logic error no such table: Incident' Pin
Dave Kreskowiak17-Nov-23 5:33
mveDave Kreskowiak17-Nov-23 5:33 
GeneralC# 12: New opportunities for auto-foot-wounding Pin
Richard Deeming16-Nov-23 0:24
mveRichard Deeming16-Nov-23 0:24 
GeneralRe: C# 12: New opportunities for auto-foot-wounding Pin
Richard MacCutchan16-Nov-23 1:11
mveRichard MacCutchan16-Nov-23 1:11 
GeneralRe: C# 12: New opportunities for auto-foot-wounding Pin
jschell16-Nov-23 5:18
jschell16-Nov-23 5:18 
QuestionC#, Winforms, Coding Pin
Hoàng Anh Quốc4-Nov-23 0:00
Hoàng Anh Quốc4-Nov-23 0:00 
AnswerRe: C#, Winforms, Coding Pin
Richard MacCutchan4-Nov-23 0:11
mveRichard MacCutchan4-Nov-23 0:11 
AnswerRe: C#, Winforms, Coding Pin
Andre Oosthuizen10-Nov-23 6:28
mveAndre Oosthuizen10-Nov-23 6:28 
QuestionHow to customize the default error message "The value '' is invalid" for dynamically generated form Pin
Fokwa Divine1-Nov-23 4:30
Fokwa Divine1-Nov-23 4:30 
I am new to asp.net core. I have a form which is generated dynamically. I want the validation error message to be "The value must be numeric" instead I get "The value 'a' is invalid" when I submit the form.

Here is my View Model:
C#
[RegularExpression("^[0-9]*$", ErrorMessage = "The value must be numeric")]
public List<int> Units_Service { get; set; }


Here is my form code:
HTML
for (int i = 0; i < Model.Workload_Category_Name.Count; i++)
{
   <div class="row">
       <div class="col-md-3">
           <b></u>@Html.DisplayFor(model => model.Workload_Category_Name[i])</u> </b>
       </div>
       <div class="col-md-4">
          @Html.TextBoxFor(model => model.Units_Service[i], new { style = "width: 15%", MaskedTextBox = "9999" })
          @Html.ValidationMessageFor(model => model.Units_Service[i])
       </div>
   </div>
 }


Despite the fact, I have put the custom error message in my View Model as shown above, I keep getting the default message "The value '' is invalid". Please what is the solution to this kind of scenario ?
AnswerRe: How to customize the default error message "The value '' is invalid" for dynamically generated form Pin
Richard Deeming1-Nov-23 5:47
mveRichard Deeming1-Nov-23 5:47 
GeneralRe: How to customize the default error message "The value '' is invalid" for dynamically generated form Pin
Fokwa Divine1-Nov-23 8:51
Fokwa Divine1-Nov-23 8:51 
AnswerRe: How to customize the default error message "The value '' is invalid" for dynamically generated form Pin
jschell2-Nov-23 4:30
jschell2-Nov-23 4:30 
GeneralRe: How to customize the default error message "The value '' is invalid" for dynamically generated form Pin
Fokwa Divine3-Nov-23 6:34
Fokwa Divine3-Nov-23 6:34 
Questionc Pin
Gorla Bhagyasree31-Oct-23 23:19
Gorla Bhagyasree31-Oct-23 23:19 
AnswerRe: c Pin
Richard Deeming31-Oct-23 23:56
mveRichard Deeming31-Oct-23 23:56 
AnswerRe: c Pin
Pete O'Hanlon1-Nov-23 21:26
mvePete O'Hanlon1-Nov-23 21:26 
QuestionC# How to grab html from selection of web browser control Pin
Tridip Bhattacharjee from Unknown26-Oct-23 11:15
Tridip Bhattacharjee from Unknown26-Oct-23 11:15 
SuggestionRe: C# How to grab html from selection of web browser control Pin
Richard Deeming26-Oct-23 21:47
mveRichard Deeming26-Oct-23 21:47 
GeneralRe: C# How to grab html from selection of web browser control Pin
Tridip Bhattacharjee from Unknown27-Oct-23 3:38
Tridip Bhattacharjee from Unknown27-Oct-23 3:38 
GeneralRe: C# How to grab html from selection of web browser control Pin
Richard Deeming27-Oct-23 3:51
mveRichard Deeming27-Oct-23 3:51 
QuestionADP Enterprise API help Pin
Mike Olmon 202125-Oct-23 12:10
Mike Olmon 202125-Oct-23 12:10 
AnswerRe: ADP Enterprise API help Pin
Richard Deeming25-Oct-23 22:32
mveRichard Deeming25-Oct-23 22:32 
GeneralRe: ADP Enterprise API help Pin
jschell26-Oct-23 4:58
jschell26-Oct-23 4:58 
QuestionIs there a way to Convert binding dataMember? Pin
Geanny Martin24-Oct-23 2:50
Geanny Martin24-Oct-23 2:50 
AnswerRe: Is there a way to Convert binding dataMember? Pin
Alan N24-Oct-23 4:21
Alan N24-Oct-23 4:21 
NewsEvergrowth.AspForMarkDigExtension is out there now... Pin
James McCullough19-Oct-23 15:25
professionalJames McCullough19-Oct-23 15:25 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.