Správičky 2 817 Blogy 948 Fórum 18 712

decimal core

photo
ivan
9. 9. 2018 0:51:29
Body: 20
Najaktívnejší č.: 290

decimal core

v net core 2.1

Preco ked vlozim do price napr. 12.41 nebere hodnotu ale pri post vrati nulu

<div class="form-group">
                <label asp-for="Movie.Price" class="control-label"></label>
                <input asp-for="Movie.Price" class="form-control" />
                <span asp-validation-for="Movie.Price" class="text-danger"></span>
            </div>
V class mam 
public decimal Price { get; set; }
v tabulke 
[Price] [decimal](18, 2) NULL,

    [HttpPost]
        [ValidateAntiForgeryToken]
        public IActionResult Editkateg(UserTema utema)
        {
test   ViewData["Greeting"] = utema.Price.ToString("G", CultureInfo.CreateSpecificCulture("en-GB"));

 

[Reakcia]

photo
ivan
9. 9. 2018 0:52:42
Body: 20
Najaktívnejší č.: 290

RE: decimal core

Preco ked vlozim do price napr. 12.41 nebere hodnotu ale pri post vrati nulu <div class="form-group">

               <label asp-for="Movie.Price" class="control-label"></label>

               <input asp-for="Movie.Price" class="form-control" />

               <span asp-validation-for="Movie.Price" class="text-danger"></span>

           </div>

V class mam

publicdecimal Price { get; set; }

v tabulke

[Price] [decimal](18, 2)NULL,

ViewData["Greeting"] = utema.Price.ToString("G", CultureInfo.CreateSpecificCulture("en-GB"));

 

[Reakcia]

photo
ivan
9. 9. 2018 0:54:24
Body: 20
Najaktívnejší č.: 290

RE: decimal core

Preco ked vlozim do price napr. 12.41 nebere hodnotu ale pri post vrati nulu <div class="form-group">

               <label asp-for="Movie.Price" class="control-label"></label>

               <input asp-for="Movie.Price" class="form-control" />

               <span asp-validation-for="Movie.Price" class="text-danger"></span>

           </div>

V class mam

publicdecimal Price { get; set; }

v tabulke

[Price] [decimal](18, 2)NULL,

[HttpPost]

       [ValidateAntiForgeryToken]

       public IActionResult Editkateg(UserTema utema)

       {

ViewData["Greeting"] = utema.Price.ToString("G", CultureInfo.CreateSpecificCulture("en-GB"));

 

[Reakcia]

photo
ivan
10. 9. 2018 23:03:18
Body: 20
Najaktívnejší č.: 290

RE: decimal core

problem vyrieseny treba ma stavenu rovnaku culturu  public class MyFirstModelBinder : IModelBinder a tag helper  public class InvariantDecimalTagHelper : InputTagHelper

 <input asp-for="Price" id="price" name="price" asp-is-invariant="true"  class="form-control" value="@Model.Price"/>

[Reakcia]



Najaktívnejší užívatelia
1. 37800 b. photo vlko
2. 21495 b. photo T
3. 15965 b. photo spigi
4. 15450 b. photo Anonymous
5. 11120 b. photo dudok
6. 9705 b. photo Liero
7. 6920 b. photo siro
8. 6245 b. photo slavof
9. 5395 b. photo duracellko
10. 4665 b. photo xxxmatko