0

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?

1
  • 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
    Commented Aug 20, 2010 at 10:01

1 Answer 1

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

1
  • As Barry has said, take a look at that answer. I also implemented a my own ModelBinder that automatically trimmed strings. Much better.
    – uriDium
    Commented Aug 20, 2010 at 10:06

Not the answer you're looking for? Browse other questions tagged or ask your own question.