c# - Is it possible to handle the bind for just one specific property? -


i'm building application culture pt-br. in case decimal places distinguished , instead of ..

this works nicely every case have here but geolocation got browser.

public class clientdata {        public float latitude { get; set; } } 

in case receive number -30.028212 model binder can't convert float because expecting -30,02821.

i know can create custom modelbinder , know create string property , convert myself in 1 want know if framework has built in solution case.

i looking solution kind of this op gave up.

is possible handle conversion of 1 property using asp.net mvc solution?

i believe easiest way solve use property.

private string latitude; public string latitude {         {         numberformatinfo format = new system.globalization.numberformatinfo();         format.currencydecimalseparator = ",";         return decimal.parse(latitude).tostring(format);     }     set     {         latitude = value;     } } 

Comments