Thursday, 27 September 2012

Make ReadOnly='True' in ASP.NET and value should be acceseble.


Some times we have seen that when we make the text box as read only the changed value of those text box is not accesseble but its visible.

so in that case we make the Fuction like below:

 void ReadOnlyTextBoxes()
    {
        txtFDate.Attributes.Add("readonly", "readonly");

    }

and call thsi fuction in

  protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {


    ReadOnlyTextBoxes();

}
    }

No comments:

Post a Comment