Click here to Skip to main content
15,885,366 members
Home / Discussions / ASP.NET
   

ASP.NET

 
GeneralRe: StringBuilder error Pin
Richard MacCutchan23-Jun-23 5:53
mveRichard MacCutchan23-Jun-23 5:53 
GeneralRe: StringBuilder error Pin
samflex23-Jun-23 5:57
samflex23-Jun-23 5:57 
GeneralRe: StringBuilder error Pin
Richard MacCutchan23-Jun-23 6:04
mveRichard MacCutchan23-Jun-23 6:04 
GeneralRe: StringBuilder error Pin
samflex23-Jun-23 6:51
samflex23-Jun-23 6:51 
AnswerRe: StringBuilder error Pin
Richard Deeming3-Jul-23 4:40
mveRichard Deeming3-Jul-23 4:40 
GeneralRe: StringBuilder error Pin
samflex5-Jul-23 15:43
samflex5-Jul-23 15:43 
QuestionPremature return to Index.razor Pin
TNCaver1-Jun-23 10:27
TNCaver1-Jun-23 10:27 
AnswerRe: Premature return to Index.razor Pin
TNCaver16-Jun-23 6:17
TNCaver16-Jun-23 6:17 
QuestionEnable to read the DIO values its getting error on page Pin
Member 1601716729-May-23 16:17
Member 1601716729-May-23 16:17 
AnswerRe: Enable to read the DIO values its getting error on page Pin
jschell30-May-23 5:24
jschell30-May-23 5:24 
QuestionRazor RadioButton ViewModel Property Binding Pin
j11codep25-May-23 16:54
j11codep25-May-23 16:54 
AnswerRe: Razor RadioButton ViewModel Property Binding Pin
Richard Deeming25-May-23 21:37
mveRichard Deeming25-May-23 21:37 
Question.Net Core 6 - IMongoCollection, Suppression State Warning CS8602 Dereference of a possibly null reference. Pin
jkirkerx16-May-23 17:56
professionaljkirkerx16-May-23 17:56 
AnswerI think I got it Pin
jkirkerx16-May-23 19:22
professionaljkirkerx16-May-23 19:22 
GeneralRe: I think I got it Pin
Graeme_Grant16-May-23 21:35
mvaGraeme_Grant16-May-23 21:35 
GeneralRe: I think I got it Pin
jkirkerx17-May-23 6:36
professionaljkirkerx17-May-23 6:36 
QuestionHttpUtility.UrlEncode in vb.net Pin
muad AHMED dr3-May-23 20:56
muad AHMED dr3-May-23 20:56 
AnswerRe: HttpUtility.UrlEncode in vb.net Pin
Richard Deeming3-May-23 21:59
mveRichard Deeming3-May-23 21:59 
QuestionVB Linq - Group invoices by store, and include all the invoice items Pin
jkirkerx19-Apr-23 9:20
professionaljkirkerx19-Apr-23 9:20 
AnswerRe: VB Linq - Group invoices by store, and recalculate margin Pin
jkirkerx19-Apr-23 10:00
professionaljkirkerx19-Apr-23 10:00 
QuestionLanguage specific UseRewriter i startup .net core 7 Pin
Tablet510-Apr-23 11:25
Tablet510-Apr-23 11:25 
AnswerRe: Language specific UseRewriter i startup .net core 7 Pin
Richard Deeming10-Apr-23 21:36
mveRichard Deeming10-Apr-23 21:36 
AnswerRe: Language specific UseRewriter i startup .net core 7 Pin
Richard Deeming11-Apr-23 2:20
mveRichard Deeming11-Apr-23 2:20 
QuestionWeird issue with input form on a simple ASP.NET core web application Pin
Maximilien22-Mar-23 6:49
Maximilien22-Mar-23 6:49 
I have a weird, or probably a simple dumb user error on a simple web application.

The project is created with the wizard. (asp.net core web app with a new controller with EF).

The database has been created and is working.

I have a model (1 string, 2 double values):
public class Person
 {
     [Key]
     public int Id { get; set; }
     public string Name { get; set; }
     public double Poids { get; set; }
     public double Glycemie { get; set; }
 }

In the generated Create Page.
<div class="row">
    <div class="col-md-4">
        <form asp-action="Create">
            <div asp-validation-summary="ModelOnly" class="text-danger"></div>
            <div class="form-group">
                <label asp-for="Name" class="control-label"></label>
                <input asp-for="Name" class="form-control" />
                <span asp-validation-for="Name" class="text-danger"></span>
            </div>
            <div class="form-group">
                <label asp-for="Poids" class="control-label"></label>
                <input asp-for="Poids" class="form-control" />
                <span asp-validation-for="Poids" class="text-danger"></span>
            </div>
            <div class="form-group">
                <label asp-for="Glycemie" class="control-label"></label>
                <input asp-for="Glycemie" class="form-control" />
                <span asp-validation-for="Glycemie" class="text-danger"></span>
            </div>
            <div class="form-group">
                <input type="submit" value="Create" class="btn btn-primary" />
            </div>
        </form>
    </div>
</div>

Addition :
in the Create method, the value for the Glycemie is zero, as if it was not entered in the form.
As if the binding did not work ???
[HttpPost]
[ValidateAntiForgeryToken]
public async Task<IActionResult> Create([Bind("Id,Name,Poids,Glycemie")] Person person)
{
    if (ModelState.IsValid)
    {
        _context.Add(person);
        await _context.SaveChangesAsync();
        return RedirectToAction(nameof(Index));
    }
    return View(person);
}

When I type in the data, name "Max" , poids (weight) "123" and glycemia 4.5 value, I get an error on the glycemia value saying the value is not valid.

See image :

When i just type 4 (instead of 4.5) it works.

I'm not sure where or what validation is done.

Anything stupid or obvious I missed ?

THanks.
CI/CD = Continuous Impediment/Continuous Despair


modified 23-Mar-23 7:42am.

AnswerRe: Weird issue with input form on a simple ASP.NET core web application Pin
Richard Deeming27-Mar-23 0:42
mveRichard Deeming27-Mar-23 0:42 

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.