Databinding Errors
-
Little Background: I have a customer class with 2 properties (FirstName and LastName). On the set of the FirstName property I have code that will not allow the name to be longer than 35 characters, if it is the property throws an exception. This works fine... Here's the problem: I have a textbox that I databind to the Customer Firstname property. This displays correctly and binds correctly. But when I enter a value that causes the Customer FirstName property to throw and exception I can't catch the exception and display a message to the user. Instead the textbox will not let me leave until it is fixed. Is there a way to catch the exception that the underlying Class throws? Mediajuggle - Design House Quality At Freelance Prices http://www.mediajuggle.com
-
Little Background: I have a customer class with 2 properties (FirstName and LastName). On the set of the FirstName property I have code that will not allow the name to be longer than 35 characters, if it is the property throws an exception. This works fine... Here's the problem: I have a textbox that I databind to the Customer Firstname property. This displays correctly and binds correctly. But when I enter a value that causes the Customer FirstName property to throw and exception I can't catch the exception and display a message to the user. Instead the textbox will not let me leave until it is fixed. Is there a way to catch the exception that the underlying Class throws? Mediajuggle - Design House Quality At Freelance Prices http://www.mediajuggle.com
I have had this problem before. I don't remember how I solved it...but, if you are still having trouble with this in a couple of days, then email me and I will dig through my old files. Sincerely, Jon Fitzgerald jonfitzgerald2@hotmail.com
-
I have had this problem before. I don't remember how I solved it...but, if you are still having trouble with this in a couple of days, then email me and I will dig through my old files. Sincerely, Jon Fitzgerald jonfitzgerald2@hotmail.com
The way I solved the problem was by overriding the OnValidating method of the textbox. It works but it is not the most elegant solution, does this sound familar? Mediajuggle - Design House Quality At Freelance Prices http://www.mediajuggle.com