Click here to Skip to main content
15,891,951 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
How do you set the maximum size of a Textbox with the size given for that field from a database in asp.net / c#?
Posted
Updated 6-Apr-11 8:06am
v3

Hi
C#
// if max chars then
TextBox1.MaxLength = 50;
// if size then
TextBox1.Width = 100;
TextBox1.Height = 10;


Assuming you are not asking about how to access the value from database.
 
Share this answer
 
Comments
Sergey Alexandrovich Kryukov 6-Apr-11 15:39pm    
Correct! My 5.
--SA
Albin Abel 7-Apr-11 2:08am    
Thanks SAKryukov
You probably shouldn't really try to do that. Some database fields can be quite large, and setting your textboxes to allow for the maximum length of a given field could completely disrupt your page layout.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900