Solved

Validation of data string length in a dataGrid

Posted on 2003-11-12
1
453 Views
Last Modified: 2010-04-16
How do we prevent overlong strings being entered into a cell column within a dataGrid (and / or FlexGrid component).
We're allowing the users to work with entries in a grid and want to prevent them entering strings that would be truncated when attempting to post to the underlying database.
We can't see a simple way of doing this.
Can anyone shed some light on this for us ?
The only way we can see at present is to validate after leaving the cell - but I'm hoping that there's a cuter way.

Thanks in advance
Steve
0
Comment
Question by:StevenK
[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
1 Comment
 
LVL 20

Accepted Solution

by:
TheAvenger earned 25 total points
ID: 9731090
There surely is: you should take the edit control through which the data is entered and set it's max length value. For this you need to have a data grid with DataGridTableStyle and DataGridTextBoxColumn for this column. Then you have:
dataGridTextBoxColumn.TextBox.MaxLength = 30;
And here you go!
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

Introduction This article series is supposed to shed some light on the use of IDisposable and objects that inherit from it. In essence, a more apt title for this article would be: using (IDisposable) {}. I’m just not sure how many people would ge…
Performance in games development is paramount: every microsecond counts to be able to do everything in less than 33ms (aiming at 16ms). C# foreach statement is one of the worst performance killers, and here I explain why.
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…

635 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