This documentation is archived and is not being maintained.

Calendar.HasWeekSelectors Method

This method supports the .NET Framework infrastructure and is not intended to be used directly from your code.

Determines whether a CalendarSelectionMode object contains week selectors.

Namespace: System.Web.UI.WebControls
Assembly: System.Web (in system.web.dll)

protected bool HasWeekSelectors (
	CalendarSelectionMode selectionMode
)
protected boolean HasWeekSelectors (
	CalendarSelectionMode selectionMode
)
protected function HasWeekSelectors (
	selectionMode : CalendarSelectionMode
) : boolean

Parameters

selectionMode

One of the CalendarSelectionMode values.

Return Value

true if the CalendarSelectionMode contains week selectors; otherwise, false.

The CalendarSelectionMode values DayWeek and DayWeekMonth both contain week selectors.

The following code example demonstrates how to determine the value of the HasWeekSelectors property in a custom Calendar control.

<%@ Register TagPrefix="aspSample" Namespace="Samples.AspNet.CS.Controls" Assembly="Samples.AspNet.CS" %>
<%@ Page language="c#" %>
<HTML>
  <HEAD>
    <title>Custom Calendar - HasWeekSelectors - C# Example</title>
  </HEAD>
  <body>
    <form id="Form1" method="post" runat="server">
      <h3>Custom Calendar - HasWeekSelectors - C# Example</h3>

      <aspSample:CustomCalendarHasWeekSelectors
        id="Calendar1"
        runat="server" />

    </form>
  </body>
</HTML>

<%@ Register TagPrefix="aspSample" Namespace="Samples.AspNet.JSL.Controls" Assembly="Samples.AspNet.JSL" %>
<%@ Page language="VJ#" %>
<HTML>
  <HEAD>
    <title>Custom Calendar - HasWeekSelectors - VJ# Example</title>
  </HEAD>
  <body>
    <form id="Form1" method="post" runat="server">
      <h3>Custom Calendar - HasWeekSelectors - VJ# Example</h3>

      <aspSample:CustomCalendarHasWeekSelectors
        id="Calendar1"
        runat="server" />

    </form>
  </body>
</HTML>

using System.Web;
using System.Security.Permissions;

namespace Samples.AspNet.CS.Controls
{
    [AspNetHostingPermission(SecurityAction.Demand, Level = AspNetHostingPermissionLevel.Minimal)]
    public sealed class CustomCalendarHasWeekSelectors : System.Web.UI.WebControls.Calendar
    {
    protected override void OnPreRender(System.EventArgs e)
    {
      // Determine if a CalendarSelectionMode.DayWeek contains WeekSelectors.
      bool hasWeekSelectors = this.HasWeekSelectors(System.Web.UI.WebControls.CalendarSelectionMode.DayWeek);

      // Call the base's OnPreRender method.
      base.OnPreRender(e);
    }
  }
}

package Samples.AspNet.JSL.Controls;

public class CustomCalendarHasWeekSelectors
    extends System.Web.UI.WebControls.Calendar
{
    protected void OnPreRender(System.EventArgs e)
    {
        // Determine if a CalendarSelectionMode.DayWeek contains WeekSelectors.
        boolean hasWeekSelectors = this.HasWeekSelectors(
            System.Web.UI.WebControls.CalendarSelectionMode.DayWeek);
        // Call the base's OnPreRender method.
        super.OnPreRender(e);
    } //OnPreRender
} //CustomCalendarHasWeekSelectors

Windows 98, Windows 2000 SP4, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see System Requirements.

.NET Framework

Supported in: 2.0, 1.1, 1.0
Show: