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 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

Sign up to request clarification or add additional context in comments.

1 Comment

As Barry has said, take a look at that answer. I also implemented a my own ModelBinder that automatically trimmed strings. Much better.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.