• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 379
  • Last Modified:

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?
0
Rouchie
Asked:
Rouchie
  • 3
  • 2
1 Solution
 
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.
0
 
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 ?
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.
0
 
RouchieAuthor Commented:
Thanks for that.  I don't suppose you know of any VB examples where I can see that in action do you...?
0
 
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.
0

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now