HTMLInputText — Making the textbox read only

The best way to do this is to set the disabled property of the text box to ‘true’.

e.g. : txtTest.Disabled = true;

The other way round is using JavaScript which does not allow user to type in the textbox.

e.g. : txtTest.Attributes.Add(“onFocus”,”javascript:blur();”);


~ by Neha Sinha on February 4, 2008.

One Response to “HTMLInputText — Making the textbox read only”

  1. You can still highlight portions of the text and drag it around in the text box though.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: