AddHandler(TextChangedKey, value);
}
remove
{
Events.RemoveHandler(TextChangedKey, value);
}
}
CHAPTER 4 ?– THE WEBCONTROL BASE C LASS AND CONTROL STYLES 139
protected virtual void OnTextChanged(EventArgs e)
{
EventHandler textChangedEventDelegate =
(EventHandler)Events[TextChangedKey];
if (textChangedEventDelegate != null)
{
textChangedEventDelegate(this, e);
}
}
override protected void AddAttributesToRender(HtmlTextWriter writer)
{
writer.AddAttribute("type", "text");
writer.AddAttribute("name", UniqueID);
writer.AddAttribute("value", Text);
base.AddAttributesToRender(writer);
}
}
}
The Web Control Style Web Form
The Web Control Style web form is a workbench for testing both the Label and the TextBox
controls we have created so far in this chapter. It has a set of controls to allow the user to interactively
change style properties, rendering the control with its new styles on the web form.
Figure 4-8 displays what the web form looks like when displayed in a browser.
The top of the form is the TextBox control with properties that are set in the .aspx tag page
to make the TextBox background gray and set its text to Tahoma font with bold and italic features:
BackColor="#E0E0E0" Font-Italic="True" Font-Names="Tahoma">Below the web form is a set of server controls that provide a control panel for styling a Label
control at the very bottom of the .
Pages:
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232