Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
625
Trouble Limiting Maximum Input Length For a Column
posted

I have a column in an UltraGrid that I want to limit to 4000 characters.  I've added code to set the maxLength for the column.

myGrid.DisplayLayout.Bands(0).Columns("TEXT1").MaxLength = 4000

But I'm still able to enter more than 4000.

To try and track this down, I've added an event handler for the Grid's CellChange event to make sure the MaxLength wasn't being reset somewhere else.

As I'm typing into the cell that I want to limit to 4000 characters, the event fires and I run the following:

? ugNote.ActiveCell.Column.MaxLength

And confirm that the maxLength is still 4000.  But I can keep typing, long past the 4000th character.  I can add code to manually enforce the MaxLength here in the event - but I was hoping to avoid that.

 

Have I missed something?  Do I need to 'turn on' the max length enforcement?

Parents
  • 37774
    Verified Answer
    posted

    Are you possibly clearing this value elsewhere, such as in the InitializeLayout?  Is the column of type string and is it using the standard editor or Style?  I just tried this out with a smaller value (5) and I couldn't type into a string column for anything longer than this.  If you're using a Style of, for example, FormattedTextEditor, I don't think that the MaxLength property will be honored because I don't believe that the FormattedTextEditor supports a MaxLength.

    -Matt

Reply Children