About the author

Vijay Kodali
E-mail me Send mail

Site Statistics

Site Meter

Recent comments

Authors

Disclaimer

The opinions expressed herein are my own personal opinions and do not represent my employer's view in anyway.

© Copyright 2010

Read-only Textbox View state problem in ASP.NET

For a Textbox with Read-only property set to true, text is not be posted back to the server side.

From MSDN..

The Text value of a TextBox control with the ReadOnly property set to true is sent to the server when a postback occurs, but the server does no processing for a read-only text box. This prevents a malicious user from changing a Text value that is read-only.

To set a Textbox read-only and keep the text on post back, use the following code..

We can get it from the Request object as shown below…

  TextBox1.Text = Request[TextBox1.UniqueID]; //Another approach… 
  TextBox1.Text = Request.Form[TextBox1.ClientID.Replace("_", "$")];

Posted by vijay on Tuesday, July 31, 2007 2:20 PM
Permalink | Comments (8) | Post RSSRSS comment feed

Comments

praveena United States

Monday, November 16, 2009 12:47 AM

praveena

Thanks a lot! Great post!!! Saved me so much time

real touch toy United States

Friday, August 27, 2010 8:25 PM

real touch toy

I appreciate your blog, Its awesome to observe not everybody is just posting a heap of waste these days!

Quinton Champagne United States

Sunday, August 29, 2010 12:00 PM

Quinton Champagne

Awesome article. I was wondering if I could use a potion of it on my own, writtin in my own words of course. Of course I will link back to you also, just get back to me with what you think.

facesitting United States

Sunday, August 29, 2010 6:32 PM

facesitting

I have been reading your blog posts during my smoke break, and I must admit the entire article has been very useful and very well composed. I thought I would let you know that for some reason this blog does not view well in IE 8. I wish Microsoft would stop changing stuff. I have a question for you. Would you mind swapping blog roll links? That would be really cool!

pozycjonowanie Japan

Monday, August 30, 2010 10:04 AM

pozycjonowanie

Smile! Because you have just received a comment from someone hoping you are fine. I love to read your blog !

boxer training United States

Wednesday, September 01, 2010 11:38 AM

boxer training

good to see a post that makes some sense! me and my boxer are happy Smile

Tony United Kingdom

Friday, September 03, 2010 8:35 AM

Tony

Thanks Vijay - this did save me a bunch of time.

And this comment is actually coming from a human. You may want to consider adding a captcha on your blog!

gravura bucuresti Romania

Tuesday, September 07, 2010 3:45 AM

gravura bucuresti

Well said, I could not agree more with you on this issue. I think your blog is very popular on this topic judging by all the other comments posted to it. I just wanted to leave a comment to appreciate your hard work that must have gone into this blog. Thanks for posting and sharing with all – Cheers - Jesse

Add comment


(Will show your Gravatar icon)

  Country flag

biuquote
  • Comment
  • Preview
Loading