Sponsored Ad

Sunday, January 3, 2010

Loosing ReadOnly Textbox values in Postback, C#.NET, ASP.NET

Use attribute property to add read-only in textbox in that case you will not loose values in textbox while postback.

 

Code Snippet
  1. protected void Page_Load(object sender, EventArgs e)
  2.     {
  3.         TextBox1.Attributes.Add("readonly", "true");
  4.     }

2 comments:

  1. THIS IS THE ONLY METHOD THAT WORKED FOR ME- I tried so many various paths....in vain. I used a hidden field and tried to implement the Request[] method and that failed. I tried to call the _dopostback javascript which did not work. This was the only implementation that produced results so thanks a ton for this message.
    ReplyDelete
  2. Thanks for encouraging us.
    ReplyDelete

Sponsored Ad

More Related Articles

Website Update

Followers