Tuesday, June 22, 2010

Showing HTML as is in Text box for ASP.NET 4.0

1. Simple thing but may get very annoying sometimes :)

2. you stored an HTML in DB. you want to show it as in Text box.

3. Note – Label and literal controls will show them as they encode by default. However Text box will not.

4. Fix – use HTML encode for the text box

No comments: