title: Validation error about Decimal data type in asp.net mvc
body: <p>I defined a data type <code>decimal(18,10)</code> for longitute and latitute in my database. But it always said <em>"validation error"</em>  when I tried to input and submit my form.
  I used <code>LINQ to SQL</code>. Is there some validation rules it generated for me otherwise why I can not input these two with something numbers like "2.34".</p>
  
  <p>Thanks in advance</p>
  
  <pre><code>namespace Nerddinner.Models
  {
      interface IDinnerRepository
      {
          IQueryable&lt;Dinner&gt; FindAllDinners();
          Dinner GetDinner(int id);
          void AddDinner(Dinner dinner);
          void UpdateDinner(Dinner dinner);
          void DeleteDinner(Dinner dinner);
      }
  }
  
  
  namespace Nerddinner.Models
  {
      public class sqlDinnerRepository: IDinnerRepository
      {
          dbDataContext db;
          public sqlDinnerRepository()
          {
              db = new dbDataContext();
          }
  
          public IQueryable&lt;Dinner&gt; FindAllDinners()
          {
              return db.Dinners;
          }
  
          public Dinner GetDinner(int id)
          {
              return db.Dinners.SingleOrDefault(x =&gt; x.DinnerID == id);
          }
  
          public void AddDinner(Dinner dinner)
          {
              db.Dinners.InsertOnSubmit(dinner);
          }
  
          public void UpdateDinner(Dinner dinner)
          {
              db.SubmitChanges();
          }
  
          public void DeleteDinner(Dinner dinner)
          {
              db.Dinners.DeleteOnSubmit(dinner);
          }
      }
  }
  
  
  namespace Nerddinner.Controllers
  {
      public class DinnerController : Controller
      {
          IDinnerRepository _repository;
          public DinnerController()
          {
              _repository = new sqlDinnerRepository();
          }
  
          public DinnerController(IDinnerRepository repository)
          {
              _repository = repository;
          }
  
          //
          // GET: /Dinner/
  
          public ActionResult Index()
          {
              var dinners = _repository.FindAllDinners();
              return View(dinners);
          }
  
          //
          // GET: /Dinner/Details/5
  
          public ActionResult Details(int id)
          {
              var dinner = _repository.GetDinner(id);
              return View(dinner);
          }
  
          //
          // GET: /Dinner/Create
  
          public ActionResult Create()
          {
              return View();
          } 
  
          //
          // POST: /Dinner/Create
  
          [HttpPost]
          public ActionResult Create(Dinner dinner)
          {
              try
              {
                  // TODO: Add insert logic here
                  _repository.AddDinner(dinner);
                  _repository.UpdateDinner(dinner);
  
                  return RedirectToAction("Index");
              }
              catch
              {
                  return View(dinner);
              }
          }
  
          //
          // GET: /Dinner/Edit/5
  
          public ActionResult Edit(int id)
          {
              var dinner = _repository.GetDinner(id);
              return View(dinner);
          }
  
          //
          // POST: /Dinner/Edit/5
  
          [HttpPost]
          public ActionResult Edit(int id, FormCollection collection)
          {
  
              var db = new dbDataContext();
              var dinner = db.Dinners.SingleOrDefault(x =&gt; x.DinnerID == id);
              try
              {
                  // TODO: Add update logic here
                  UpdateModel(dinner, collection.ToValueProvider());
                  _repository.UpdateDinner(dinner);
                  return RedirectToAction("Index");
              }
              catch
              {
                  return View(dinner);
              }
          }
  
          //
          // POST: /Dinner/Delete/5
  
          [HttpPost]
          public ActionResult Delete(int id)
          {
              var db = new dbDataContext();
              var dinner = db.Dinners.SingleOrDefault(x =&gt; x.DinnerID == id);
              try
              {
                  // TODO: Add delete logic here
                  _repository.DeleteDinner(dinner);
                  _repository.UpdateDinner(dinner);
                  return RedirectToAction("Index");
              }
              catch
              {
                  return View(dinner);
              }
          }
      }
  }
  </code></pre>
  
  <p>Thanks for helping me.</p>