Tuesday, October 11, 2011

Calendarextender vs Read Only Textbox

Always get incorrect data from readonly textbox when you use Calendar Extender?

To fix this:
  1. Set readonly in Textbox property to False
  2. Use the following code in PageLoad Event
  3. protected void Page_Load(object sender, EventArgs e) {       
    TextBox1.Attributes.Add("readonly", "readonly"); 
    }