Gridview Column Length

V

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
 
C

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,780
Messages
2,569,611
Members
45,264
Latest member
FletcherDa

Latest Threads

Top