– How to make text box as Read Only

There are two ways of doing it without using javascript:

1) In .aspx side in the declaration of TextBox use the property ReadOnly=“true” and the user wont be able to alter the text box text unless specified from the code behind .cs side.

2)in .cs side where in we can write txtUserName.ReadOnly = true; we can write it  in page load or in button click event or to show default text in text box can supply the text from code behind like this  txtUserName.Text = “Dilip”; where  txtUserName is the ID of the TextBox.

Reference : Dilip Kumar Jena ( )


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 )

Google photo

You are commenting using your Google 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 )

Connecting to %s