Wednesday, March 14, 2012

Making a TextBox ReadOnly

Making a TextBox ReadOnly

asp:textbox id="txtItemTotal_Edit" class="TextBoxReadOnlyStyle" text="abcd" enabled="false" enableviewstate="true">' runat="server"> /asp:textbox


If you want your TextBox to behave like a label but need the values retained during a postback i.e, in ViewState then using Enabled="false" and EnableViewState="true" attributes, is one way to do it. You can apply any desirable style to your textbox using css.

No comments: