Solved

Validation of data string length in a dataGrid

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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Device Location 4 29
Best resource to learn entity framework 2 32
Expression Evaluater 3 24
How come this regular expression allows "e"? 14 34
This article describes a simple method to resize a control at runtime.  It includes ready-to-use source code and a complete sample demonstration application.  We'll also talk about C# Extension Methods. Introduction In one of my applications…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
Windows 10 is mostly good. However the one thing that annoys me is how many clicks you have to do to dial a VPN connection. You have to go to settings from the start menu, (2 clicks), Network and Internet (1 click), Click VPN (another click) then fi…
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.

813 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

8 Experts available now in Live!

Get 1:1 Help Now