Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6927439
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T11:03:22+00:00 2026-05-27T11:03:22+00:00

I have complex model with double values…I have problem with pass them into object.

  • 0

I have complex model with double values…I have problem with pass them into object. When I pass integer values (like 4 or 5) everything is ok, but when I try pass double value (like 4.3 or -23.3) during debugging I see that model has 0.0.

public class Coordinates
{
    public int ID { get; set; }

    [Required]
    public double Latitude { get; set; }

    [Required]
    public double Longitude { get; set; }
}

    [HttpPost]
    public ActionResult Edit(Place place)
    {
        var updatedPlace = db.Place.Include(c => c.Country).Include(c => c.Coordinates).Where(p => p.ID == place.ID).SingleOrDefault();
        updatedPlace.Coordinates.Latitude = place.Coordinates.Latitude;
        updatedPlace.Coordinates.Longitude = place.Coordinates.Longitude;
        updatedPlace.Country = db.Country.Find(place.Country.ID);
        updatedPlace.Description = place.Description;
        updatedPlace.Name = place.Name;
        db.Entry(updatedPlace).State = EntityState.Modified;
        db.SaveChanges();
        return RedirectToAction("Index");
    }

In view I use:

@Html.EditorFor(model => model.Coordinates.Latitude)
@Html.EditorFor(model => model.Coordinates.Longitude)
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T11:03:23+00:00Added an answer on May 27, 2026 at 11:03 am

    The default model binder uses the current culture setting when parsing the request values into your model properties. So for example if you have culture set to auto then it will use that of the client browser (Accept-Language HTTP request header). And if you have a client from France (fr-FR) and he enters 4.3 in the input field the default model binder won’t be able to parse it back to a double because in France they use , as decimal separator not ..

    So you could set the culture in the web.config to some fixed value:

    <globalization culture="en-US" uiCulture="en-US" />
    

    Or if you need to support multiple scenarios and cultures you could also write a custom model binder.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a 'Complex' model which hasMany Unit. My model associations are correct, everything
We are using Hibernate as persistency layer and have complex object model. Without exposing
I have a fairly complex model needing to be validated, the problem is that
Well i have a complex form view model like this : public class TransactionFormViewModel
I have a problem with NSUndoManager not undoing when working with a complex model.
If I have a fairly complex User model that I would like to use
We have a complex business model and is using NHibernate to create and maintain
I have a somewhat complex data model in my iPad application (an OpenGL drawing
I have a complex model class, of which only a few string columns should
I have a complex database model set up in Django, and I have to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.