Home All Groups Group Topic Archive Search About
Author
10 Jan 2006 5:42 AM
VictorReinhart
Hi,
Is there a way to limit Gridview Column Length?

It would be nice to limit the length to the length of the column in the
database.  Shouldn't that behaviour be built-in?

For example, my "Comments" column is 30 characters long.  But, once in
"Edit Mode", the user can type in more than 30 characters.

Then, the database truncates the excess characters past 30.

What can I do?

Thank you

VictorReinhart

Author
10 Jan 2006 12:35 PM
Christopher Reed
If you're using a Textbox control for editing, then you could set the
MaxLength property to 30.  If you have it set to use multiple lines like a
TextArea HTML control, then you probably need to test the length prior to
entering it into your database.

Also look at the ItemStyle property for the Columns of the GridView control.
You could set widths within the ItemStyle property for your Columns,
assuming that you define your own columns.
--
Christopher A. Reed
"The oxen are slow, but the earth is patient."

Show quoteHide quote
"VictorReinhart" <victora.reinh***@phs.com> wrote in message
news:1136871745.071385.48240@g14g2000cwa.googlegroups.com...
> Hi,
> Is there a way to limit Gridview Column Length?
>
> It would be nice to limit the length to the length of the column in the
> database.  Shouldn't that behaviour be built-in?
>
> For example, my "Comments" column is 30 characters long.  But, once in
> "Edit Mode", the user can type in more than 30 characters.
>
> Then, the database truncates the excess characters past 30.
>
> What can I do?
>
> Thank you
>
> VictorReinhart
>