VB, .NET, SQL Server, MOSS
Programming for life!
Serving the web community
with my knowledge

When you make an ASP.Net textbox disabled by setting the Enabled property to false, the Text property is not persisted in ViewState. This is a bug in Internet Explorer. But anyway, I just want this problem to be solved, so I made a workaround.
You need to set the ReadOnly property instead of the Enabled property. Furthermore, you could change the display style (make the text gray) by using the Style property.
protected System.Web.UI.WebControls myTextBox;
private void Page_Load(object sender, System.EventArgs e)
{
myTextBox.ReadOnly = true;
myTextBox.Style["color"] = "gray";
}
<asp:textbox runat="server" id="myTextBox" ReadOnly="True" ForeColor="gray" />
document.getElementById('myTextBox').readOnly = true;
document.getElementByid('myTextBox').style.color = 'gray';
Last modified on: 2005-09-22