Solved

Validation of data string length in a dataGrid

Posted on 2003-11-12
1
447 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

Salesforce Made Easy to Use

On-screen guidance at the moment of need enables you & your employees to focus on the core, you can now boost your adoption rates swiftly and simply with one easy tool.

Question has a verified solution.

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

Introduction Although it is an old technology, serial ports are still being used by many hardware manufacturers. If you develop applications in C#, Microsoft .NET framework has SerialPort class to communicate with the serial ports.  I needed to…
We all know that functional code is the leg that any good program stands on when it comes right down to it, however, if your program lacks a good user interface your product may not have the appeal needed to keep your customers happy. This issue can…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…
Are you ready to implement Active Directory best practices without reading 300+ pages? You're in luck. In this webinar hosted by Skyport Systems, you gain insight into Microsoft's latest comprehensive guide, with tips on the best and easiest way…

734 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