Handling Postback Data
If your control needs to process form data submitted to the server, you need to implement the IPostbackDataHandler
interface. This interface includes the following two methods:
• LoadPostData()
—
Receives the form fields posted from the browser.
• RaisePostDataChangedEvent()
—
Enables you to raise an event indicating that the value of a form field has been changed.
For example, the control in Listing 36.16 is a simple TextBox
control that implements the IPostbackDataHandler
interface to preserve the state of an input field across postbacks.
Listing 36.16. CustomTextBox.cs
The LoadPostData()
receives the form fields posted ...
Get ASP.NET 4 Unleashed now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.