The RichControls Web Form Code-Behind Class File
using System;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace ControlsBook2Web.Ch01
{
public partial class RichControls : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void Date_Selected(object sender, EventArgs e)
{
Label1.Text = "Selected: " + Calendar1.SelectedDate.ToLongDateString();
}
}
}
The rich controls demonstration has the least amount of code surface area of all the demonstrations
we??™ve shown in this chapter. The .aspx page contains the Calendar control and all the
declarative settings to have the Calendar render in a manner pleasing to the eye, along with a
Label control to display the selected date. The code-behind has a Date_Selected() method
mapped to the SelectionChanged event of the Calendar control to set the value of the Label control
to the date we select (by clicking it). Figure 1-14 shows the output from this rich controls
demonstration.
CHAPTER 1 ?– SERVER CONTROL BASICS 31
Figure 1-14. Output from the rich controls web form
Rich Controls and XSLT
Another interesting control from the rich controls portion of the System.Web.UI.WebControls
namespace is the XML control.
Pages:
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83