11.3. Solution

Now you have an idea of what web parts are and how they can be used. Microsoft made this very simple and I can tell you from experience it works on a large scale and doesn't affect performance. Getting back to Mary's application, the goal of the home page is to act as a dashboard into the PTO application. Three web parts will be added to the dashboard: one for the current user's requests, one that displays any requests the current user is supposed to approve, and one that displays the current user's requests as a calendar. Refer to Figure 11-1 to see how the dashboard will look.

Add a new page to the project called Home.aspx and have it use the PaidTimeOff.master page and inherit from BasePage. Implement the two BasePage abstract methods as follows:

public override string MenuItemName()
{
    return "Home";
}

public override string[] CapabilityNames()
{
    return new string[] { "Home" };
}

In order for this page to work, you need to create a record in the ENTMenuItem table. The only difference between this page and the other records is that the IsAlwaysEnabled field should be set to True. This is the home page, so everyone will have access to it. In addition, because no capabilities are associated with this page, the "Capability Check" functionality in the base page should be turned off. To do this, override the OnInit method in the Home.aspx page:

protected override void OnInit(EventArgs e)
{
    IgnoreCapabilityCheck = true;
    base.OnInit(e);
}

Now switch back to the source ...

Get ASP.NET 3.5 Enterprise Application Development with Visual Studio® 2008: Problem - Design - Solution now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.