i want to trim a string in asp.net mvc . i will be doing that in controller where there is a updatemodel implemented or datannotation class or a view? where will be i doing that?
Asked
Active
Viewed 1,363 times
0
-
i have a textboxes bind to the model , i want to trim any string inside the textboxes. i am using linq to sql with asp.net mvc 2 – maztt Aug 20 '10 at 10:01
1 Answers
3
If you want trim strings that Users have entered then take a look at this answer
Although this answer only overrides the SetProperty method you could always extend the class and add a method to override the GetPropertyValue

Community
- 1
- 1

codingbadger
- 42,678
- 13
- 95
- 110
-
As Barry has said, take a look at that answer. I also implemented a my own ModelBinder that automatically trimmed strings. Much better. – uriDium Aug 20 '10 at 10:06