ASP.NET DetailsView Update exception handling - truncated data
Posted on 2015-01-03
I'm using a DetailsView for updating a record. If the edit input of some fields is too long, the system produces a "data will be truncated" exception.
I can see where I can detect the error in DetailsViewItemUpdating or DetailsViewItemUpdated, and provide a user message. However, I believe the visual feedback should be sufficient for this release, i.e. "hey, it didn't take my 30 characters, even though the header label said it would only allow 20".
Is there a way to force the DetailsView to do the truncation and accept the update?
Or some other approach to this data handling exception, which must be pretty common.