"Pro ASP.NET 3.5 Server Controls and AJAX Components"
Empty); } protected override void Render(HtmlTextWriter writer) { base.Render(writer); Page.VerifyRenderingInServerForm(this); if (Display == ButtonDisplay.Button) { writer.Write("writer.Write(" name=\"" + this.UniqueID + "\""); writer.Write(" id=\"" + this.UniqueID + "\""); writer.Write(" value=\"" + Text + "\""); writer.Write(" />"); } else if (Display == ButtonDisplay.Hyperlink) { writer.Write("writer.Write(Page.ClientScript.GetPostBackClientHyperlink(this, "")); writer.Write("\">" + Text + ""); } } } } Using the SuperButton Control on a Web Form The SuperButton web form hosts two SuperButton controls: one of the button variety and the other of the hyperlink persuasion. It also has a label that is set according to event handlers for each button. The first request to the web form generates the page shown in Figure 5-14. Listings 5-10 and 5-11 provide the source code for this web form. 218 CHAPTER 5 ?– SE RVER CONTROL EVENTS Figure 5-14. The SuperButton web form rendering its first request Listing 5-10. The SuperButton Web Form .aspx File <%@ Page Language="C#" MasterPageFile="~/MasterPage/ControlsBook2MasterPage.Master" AutoEventWireup="true" CodeBehind="SuperButton.