DataGrid edit row's maxlength settings

When using a dataGrid or the new GridView, in row Edit mode can ASP.NET automatically set the maxlength value of a textbox to match that of the underlying database?
i.e. say SQL Server has a varchar(10) column that is being displayed in the datagrid, can ASP.NET limit the textbox to MAXLENTH="10" to reflect this automatically?
LVL 25
RouchieAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

naveenkohliCommented:
No, you will have to do it yourself. You can always get the schema of the table and using that information you can set the limits on the text boxes.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
RouchieAuthor Commented:
Hi Naveen
That's what I've been doing but I realized that simply to add this there's around a 600% increase in code due to the way the templatecolumns work!  I hoped there would be some way around it, but I guess it would make debugging a lot more tricky.

Is there any resolve in ASP.NET 2.0 ?
naveenkohliCommented:
No there is no resolve. You can declare bussiness object for your table. And get the schema information once and set it as static properties of the objects. Then its done once for the life of the application and then you can use it places where you want. There will initial hit when this object is accessed first time. After that you will be all set.
RouchieAuthor Commented:
Thanks for that.  I don't suppose you know of any VB examples where I can see that in action do you...?
naveenkohliCommented:
I don't know. I program in C#. So I use static constructor of the objects to do this kind of stuff. I don't know if there is similar concept in VB.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
ASP.NET

From novice to tech pro — start learning today.