468,478 Members | 2,392 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,478 developers. It's quick & easy.

Dynamically setting textbox width

What's the trick to dynamically setting the width of a textbox?

In the code behind page Page_Load function I'm trying to dynamically set the
width of a textbox.

TextBox1.Width = "75px"

I keep getting an error that the size has to be in WebControls.Units.

I tried doing a CType to cast the value as a WebControl Unit and also tried
using "75" and 75. Neither worked.

What am I missing?
Nov 20 '05 #1
2 9804
TextBox1.Width = New WebControls.Unit(75)

"Jacques Leclerc" <ja*************@hotmail.com> wrote in message
news:OI**************@TK2MSFTNGP09.phx.gbl...
What's the trick to dynamically setting the width of a textbox?

In the code behind page Page_Load function I'm trying to dynamically set the width of a textbox.

TextBox1.Width = "75px"

I keep getting an error that the size has to be in WebControls.Units.

I tried doing a CType to cast the value as a WebControl Unit and also tried using "75" and 75. Neither worked.

What am I missing?

Nov 20 '05 #2
Hello

I tried textbox1.width = 75 and it worked fine..

How about : Me.TextBox1.Size = New System.Drawing.Size
(80, 20)

Kind Regards
Jorge
-----Original Message-----
What's the trick to dynamically setting the width of a textbox?
In the code behind page Page_Load function I'm trying to dynamically set thewidth of a textbox.

TextBox1.Width = "75px"

I keep getting an error that the size has to be in WebControls.Units.
I tried doing a CType to cast the value as a WebControl Unit and also triedusing "75" and 75. Neither worked.

What am I missing?
.

Nov 20 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

5 posts views Thread by Laura | last post: by
8 posts views Thread by Donald Xie | last post: by
reply views Thread by Mike Collins | last post: by
reply views Thread by NPC403 | last post: by
1 post views Thread by kmladenovski | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.