Thursday, February 02, 2006

Custom Control

I created a simple web custom control that had a textbox as part of of its control collection. For some reason, the textbox would loses its value after a postback, which I assumed was because the textbox was loosing its viewstate (or couldn't find it). I searched a couple hours before I found INamingContainer. If you add INamingContainer as an interface to your custom control, the textbox will magically be able to maintain its viewstate after each postback.

No comments: