So, to modify Render in the target server
control, the control adapter would override method to implement the new functionality. Not
every method must be implemented in order to create a control adapter. In the next section,
we briefly discuss page adapters.
The PageAdapter Base Class
The PageAdapter class is an abstract class that can be implemented to adapt a web page for a
specific class of browsers as well as to alter ASP.NET web form behavior. Before implementing
a custom PageAdapter class, instead consider implementing a custom text writer class that
derivers from HtmlTextWriter as a means to provide the desired functionality.
The example in the documentation called CustomPageAdapter overrides the
RenderBeginHyperlink method in order to add a src attribute that points to the current page for
all hyperlink controls on the page. This is an example of creating a PageAdapter for a reason
beyond targeting a specific class of browsers.
Another example available on the Internet demonstrates a PageAdapter class that alters
the way ASP.NET handles ViewState. There are two ways to do this with a very small amount of
code, and both require that session state is enabled. The first method is to override PageAdapter.
LoadPageStateFromPersistenceMedium and PageAdpater.
Pages:
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614