Solved

Validation of data string length in a dataGrid

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Article by: Najam
Having new technologies does not mean they will completely replace old components.  Recently I had to create WCF that will be called by VB6 component.  Here I will describe what steps one should follow while doing so, please feel free to post any qu…
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…
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, just open a new email message. In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…

867 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now