Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

TryUpdateModel with a currency formatted value?

Tags:

c#

asp.net-mvc

Is there any way to get UpdateModel or TryUpdateModel to parse a money or currency formatted value such as $1,200.00 into a decimal without blowing chunks?

like image 428
Michael Cook Avatar asked Nov 22 '09 22:11

Michael Cook


1 Answers

Use a custom model binder.

An example of using one to parse a decimals differently

like image 105
eglasius Avatar answered Oct 14 '22 05:10

eglasius