Print Page | Close Window

MaxTextLength

Printed From: IdeaBlade
Category: DevForce
Forum Name: DevForce Classic
Forum Discription: For .NET 2.0
URL: http://www.ideablade.com/forum/forum_posts.asp?TID=318
Printed Date: 25-Mar-2025 at 1:43pm


Topic: MaxTextLength
Posted By: Customer
Subject: MaxTextLength
Date Posted: 19-Jul-2007 at 3:44pm

On the DataRow there is an attribute called MaxTextLength but I don't see it exposed on the EntityColumn class. Is there a way to access it?




Replies:
Posted By: IdeaBlade
Date Posted: 19-Jul-2007 at 3:46pm

Try this:

 

      AttributeCollection atts = EntityPropertyDescriptors.Employee.FirstName.Attributes;

      foreach (Attribute anAttribute in atts) {

        if (anAttribute is MaxTextLengthAttribute) {

          MaxTextLengthAttribute maxAttr = anAttribute as MaxTextLengthAttribute;

          MessageBox.Show(maxAttr.MaxLength.ToString());

        }

      }

 




Print Page | Close Window