The Calendar control
With the control there are various options which helps the user selction between a month, week , date or all the above:
- Day - Allows selection of a single day
- Week - Allows selection of a date or a week
- DayWeekMonth - Allows selection of a single day, week or a whole month
- None - No selection can be made
In addition to this the calendar control consists of a range of properties which helps you to format its look and behaviour.
The calendar control also exposes few events:
- SelectionChanged - This is the primary event and is triggered when user selects a date on the control. You can access the selected dates via the SelectedDates property.
- VisisbleMonthChanged - This causes a postback when the user selects a different month to be viewed
The calendar control can also be used to display schedule.
The Panel Control
The panel control is used as a control container. It is useful when you want to group controls and work then as a single unit. They can be really useful if you want to toggle the visibility of a set of controls.
In the source view the Panel Control is represented as <asp:Panel> and it is rendered as a <div> to the browser.
Here are some of the main properties of a panel control:
- BackImageUrl - path to the background image of the panel control
- HorizontalAlignment - Sets the horizontal alignment of the controls in the panel
- Wrap - Specifies whether the items in the Panel automatically continue on the next line when the line is longer than the width of the panel
- DefaultButton - Specifies the button that is clicked when user hits enter key on the keyboard. It can be set to any control on the form which implements IButtonInterface.
MultiView and View Controls
The MultiView and View controls are also container controls. The MultiView and View controls are meant to work together. A View control must be contained inside a MultiView control. A View consist of many controls and MultiView contains many View controls.
In the source a MultiView is represented as <asp:MultiView> and View is represented as <asp:View> The set of controls can be used to toggle the visibility of a set of controls. Only one View can be visible at any point of time. The ActiveViewIndex or SetActiveView can be used to change the view programmatically. If the ACtiveViewIndex is set to -1, no Views are displayed. If an invalid View or null is passed into SetActiveView method an HttpException is thrown.
As an example consider a multistep registration process, each step can be put into a View. The buttons can be set as command buttons. The CommandName property can be checked to determine which button has been clicked.
The Wizard Control
The Wizard control is used to create wizards. It provides functionality to ensure that only one step in the wizard is visible at one time. It is used to break down user input to logical chunks and the steps can be validated either at end of each step or at the end of the entire process.
The Wizard control contains a header area that can be customised to display information specific to the step which the user is engaged with. There is also a sidebar area to navigate between the steps and this can be programmatically controlled as well.
The built-in navigation capabilities determine which buttons are displayed. The BaseWizardStep class contains the StepType property which can be set to one of the WizardStepType enumeration values:
- WizardStepTye.Auto - This is the default option. This renders navigation buttons based on the location of the step within the WiardSteps collection property of the Wizard control.
- WizardStepTye.Complete - This is the last step to appear. No navigation buttons appear
- WizardStepTye.Finish - This is the final data collection step, the Finish and Previus buttons are available.
- WizardStepTye.Start - This is the first step to appear, only the Next button is rendered
- WizardStepTye.Step - This is a step between Start and Finish steps. The Previous and Next buttons are rendered.
This is a summary of many of the special controls in ASP.Net. Hope you like the article.