Solved

ASP.NET DetailsView Update exception handling - truncated data

Posted on 2015-01-03
2
112 Views
Last Modified: 2015-01-04
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.
0
Comment
Question by:codequest
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 12

Accepted Solution

by:
Ammar Gaffar earned 500 total points
ID: 40529945
I think it is better to convert targeted column to TemplateField, and place text box inside Column's EditItemTemplate set the DataBindings property and from here you will have text box that can set MaxLength property to 20.
This way your text box will not accept more than 20 chars so you will be fine.

Good Luck
0
 
LVL 2

Author Comment

by:codequest
ID: 40530335
Worked well.  Very slick.  Thanks, big help!
0

Featured Post

SharePoint Admin?

Enable Your Employees To Focus On The Core With Intuitive Onscreen Guidance That is With You At The Moment of Need.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Sometimes in DotNetNuke module development you want to swap controls within the same module definition.  In doing this DNN (somewhat annoyingly) swaps the Skin and Container definitions to the default admin selections.  To get around this you need t…
User art_snob (http://www.experts-exchange.com/M_6114203.html) encountered strange behavior of Android Web browser on his Mobile Web site. It took a while to find the true cause. It happens so, that the Android Web browser (at least up to OS ver. 2.…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…

624 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question