|
-
Sep 30th, 2009, 02:34 AM
#1
Thread Starter
Addicted Member
Need to increase width of control automatically
Hi,
I retrieve name from database in my "Name" table(tblname). lots of large and small name is stored. eg: alex mandra george, stephen, Tara jessy nock.
I retrieve data from database and store in the label control. I fixed the width for this label. Once is very large name stored it may be extended from my label width. The control will change automatically and need to show full name. If i put width:auto Is it possible that it is changed automatically??
hope urs reply??
Failing to plan is Planning to fail 
-
Sep 30th, 2009, 03:26 AM
#2
Re: Need to increase width of control automatically
Hey,
Can you provide a screen shot of what you are referring to?
I am struggling trying to picture what you are doing!?!?
Gary
-
Sep 30th, 2009, 03:38 AM
#3
Thread Starter
Addicted Member
Re: Need to increase width of control automatically
Hi gep,
A label inside i get the value from db. How it would be? Gep123 is showing in label.ok. while i retrieve from db and assign to label. Its small name. My label width is fixed. (eg;30px) Suppose the name is large, it mean its showing in label but we cant see full name for this width. eg: Alexandar lieopard is name. The label is not enough for this name in design. So what we do? we just click on the label and move cursor and read full name. I dont want to read using mouse cursor. Whatever name will come (large or small) the label width is adjustable.
Is it possible?? This is my question. sorry i couldnt place image here.
Hope yours reply.
Thanks
Failing to plan is Planning to fail 
-
Sep 30th, 2009, 04:03 AM
#4
Re: Need to increase width of control automatically
Hey,
So, what happens when you set the size of the label to Auto? Does that not work for you?
The other way would be to use MeasureString:
http://msdn.microsoft.com/en-us/libr...urestring.aspx
On the text that is returned from the Database, and then set the size of the Label control.
Gary
-
Sep 30th, 2009, 09:27 AM
#5
Junior Member
Re: Need to increase width of control automatically
Hey, I know I've come across this in repeater controls...so, not sure if it's the same scenario in a label, but I think so...anyway, are setting the width by setting the "style" attribute of the control? Typically, I found that if you use the "style=width:somewidth" then that sticks, but if you use the Width attribute directly on the control, it will resize to fit the text in the control...
-
Oct 1st, 2009, 01:20 PM
#6
Re: Need to increase width of control automatically
Don't set a width on the label at all then. The label will automatically expand (it's a <span>) to accommodate the contents (the long name).
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|