Calendar demo

Source of: GridSize.aspx

<script runat="server">

    protected override void OnLoad(EventArgs e) {
        base.OnLoad(e);
        Sch.TimeResolution = (TimeResolutions)Enum.Parse(
            typeof(TimeResolutions), ResolutionDropDown.SelectedValue);
        Sch.CellWidth = Unit.Parse(CellWidthText.Text);
        Sch.RowHeight = Unit.Parse(RowHeightText.Text);

        int ncols = int.Parse(NumerOfColsEdit.Text);
        if (ncols<1) ncols = 1;
        if (ncols>1000) ncols = 1000;
        Sch.NumberOfCols = ncols;
        NumerOfColsEdit.Text = ncols.ToString();

        //
        // Controlling ability to scroll contents of the scheduler control.
        //
        if (HorizontalScrollbarCheck.Checked)
            Sch.ViewOptions |= SchedulerViewOptions.InvisibleHorizontalScrollBar;
        else
            Sch.ViewOptions &= ~SchedulerViewOptions.InvisibleHorizontalScrollBar;
        if (VerticalScrollbarCheck.Checked)
            Sch.ViewOptions |= SchedulerViewOptions.InvisibleVerticalScrollBar;
        else
            Sch.ViewOptions &= ~SchedulerViewOptions.InvisibleVerticalScrollBar;
    }

</script>

    <gos:Scheduler ID="Sch" runat="server" Height="252px" Width="100%" Caption="Grid size parameters"
        LinkLine="1px DarkGray Solid" BehaviorOptions="AllowOverlapItems, Default">
        <Columns>
            <gos:ResourceColumn Text="Caption">
            </gos:ResourceColumn>
        </Columns>
    </gos:Scheduler>
    <br />
    Choose one of the available resolutions: Scheduler.TimeResolution:
    <asp:DropDownList ID="ResolutionDropDown" runat="server" AutoPostBack="True">
        <asp:ListItem>OneDay</asp:ListItem>
        <asp:ListItem>HalfDay</asp:ListItem>
        <asp:ListItem>SixHour</asp:ListItem>
        <asp:ListItem Selected="True">OneHour</asp:ListItem>
        <asp:ListItem>HalfHour</asp:ListItem>
        <asp:ListItem>QuartHour</asp:ListItem>
        <asp:ListItem>TenMinutes</asp:ListItem>
        <asp:ListItem>FiveMinutes</asp:ListItem>
    </asp:DropDownList><br />
    Number of columns for a unit of time: Scheduler.NumerOfCols:
    <asp:TextBox ID="NumerOfColsEdit" runat="server" AutoPostBack="True" Width="71px">48</asp:TextBox><br />
    Cell size setting properties: Scheduler.CellWidth:
    <asp:TextBox ID="CellWidthText" runat="server" AutoPostBack="True" Width="65px">20px</asp:TextBox>,
    Scheduler.RowHeight:
    <asp:TextBox ID="RowHeightText" runat="server" AutoPostBack="True" Width="65px">20px</asp:TextBox><br />
    Hiding vertical or horizontal scrollbars:
    <asp:CheckBox ID="HorizontalScrollbarCheck" runat="server" AutoPostBack="True" Text="SchedulerViewOptions.InvisibleHorizontalScrollBar:"
        TextAlign="Left" />,
    <asp:CheckBox ID="VerticalScrollbarCheck" runat="server" AutoPostBack="True" Text="SchedulerViewOptions.InvisibleVerticalScrollBar:"
        TextAlign="Left" /><br />
    <br />
    <span style="font-size: 8pt">Both time period and resolution of time presented in the
        scheduler depends on values of two properties: <em>Scheduler.TimeResolution</em>
        and <em>Scheduler.NumberOfCols</em>. Multiplying a unit of time and a number of
        columns determines an interval time displayed. Additionally, using a <em>Scheduler.FirstDateTime</em>
        property an origin and a <em>Scheduler.LastDateTime</em> property the end of time
        axis can be set. Changing a <em>Scheduler.LastDateTime</em> property you force recalculation
        of a <em>Scheduler.NumberOfCols</em> property. Buttons going to either next or previous
        period of time change origin of a time axis in a scheduler. Time period is not changed.
        However, a number of columns could change. A situation when a scheduler shows a
        whole month (or months) causes changing the number of columns. Then changing to
        next or previous period of time is performed in such a way that the same number
        of full months are displayed.
        <br />
        Size of a time unit cell and row height can be set. A <em>Scheduler.CellWidth</em>
        property determines width of a time unit cell. A <em>Scheduler.RowHeight</em> property
        determines height of all rows in a control.<br />
        The size of whole scheduler control depends on assigned to the scheduler control
        both properties: <em>Scheduler.Width </em>and <em>Scheduler.Height</em>. If the
        content is bigger than specified size, the scrollbars allow user to scroll currently
        hidden part of the grid. However, you can hide horizontal or vertical or both scrollbars.
        If the vertical scrollbar was hidden, the height of the scheduler depends on number
        of visible rows. Similarly, if the horizontal scrollbar was hidden, the width of
        the scheduler depends on number of the grid columns and width of the particulars
        cells.<br />
        <br />
        Notice, many scheduler properties, especially appearance and behavior properties,
        are not serialized between particularly requests. Therefore, if you initialize these
        properties from the page code, keep in mind you need do it every request, regardless
        of the <em>Page.IsPostback</em> property.<br />
        However, if you use standard properties setting with helping design mode and properties
        window, don�t worry, the automatically generated by the ASP.NET interpreter code
        does it for you. So, you just choose proper property value in the property grid,
        that�s all.<br />
        <br />
        Notice, if you need to set or reset any behaviour or appearance<em> </em>flag you
        should use the &amp; and | bitwise operators, like here:<br />
        [C#]<br />
        for setting: Sch.ViewOptions |= SchedulerViewOptions.InvisibleHorizontalScrollBar;<br />
        for resetting: Sch.ViewOptions &amp;= ~SchedulerViewOptions.InvisibleHorizontalScrollBar;<br />
        [VB]<br />
        for setting: Sch.ViewOptions = Sch.ViewOptions Or SchedulerViewOptions.InvisibleHorizontalScrollBar<br />
        for resetting: Sch.ViewOptions = Sch.ViewOptions And Not SchedulerViewOptions.InvisibleHorizontalScrollBar<span
            style="font-size: 10pt"> </span>
        <br />
        <br />
        Operation of this sample page is very simple. After setting the fields below a scheduler
        are set, a <strong>request</strong> to a server (<strong>postback</strong>) is generated
        and <em>Scheduler</em> object properties initialized with values entered in fields
        using a <em>OnLoad()</em> server method.</span>

(C) ComponentGo! 2010 | Home | Site map | Partners | Links | Forum | info@componentgo.com