By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
448,966 Members | 1,463 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 448,966 IT Pros & Developers. It's quick & easy.

Set width dynamically for textbox based on length

P: n/a
Hi,

I would like to set the width of a textbox from the server in an aspx
form. I change the contents of the textbox from the server and would
like to change the width accordingly. I know there is code out there
to use creategraphics to do this, but it will not work for aspx files.
It seems like such a simple thing. Does anyone have any code snippets
they would like to share?

Thanks,
Teresa

Nov 19 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Hi Teresa,

All this code is for VB6. You could easily apply it to VB.NET or C#.

This code should get you on your way.

http://www.experts-exchange.com/Prog..._21291567.html

Good Luck!

Nov 19 '05 #2

P: n/a
there is no perfect solution, as the dom does not expose enough info to do
it in client script. the best you can do is specify the width in em(s) or
pt(s) which are relative to the fontsize rather than pixels (which isn't).
as most fonts are proportional you can only estimate.

-- bruce (sqlwork.com)

<ta******@yahoo.com> wrote in message
news:11**********************@g14g2000cwa.googlegr oups.com...
Hi,

I would like to set the width of a textbox from the server in an aspx
form. I change the contents of the textbox from the server and would
like to change the width accordingly. I know there is code out there
to use creategraphics to do this, but it will not work for aspx files.
It seems like such a simple thing. Does anyone have any code snippets
they would like to share?

Thanks,
Teresa

Nov 19 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.