[]
The quick start guides you through the steps of adding a Calendar control to your application to display a months calendar with highlighted today's date. For information on how to add ASP.NET MVC Edition controls, see Adding Controls.
Follow the given steps to get started:
Create a new MVC application using the ComponentOne or VisualStudio templates. For more information about creating an MVC application, see Configuring your MVC Application topic.
Add a new Controller:
Default1Controller
).Add a View for the controller:
Default1Controller
) to open it.Index()
.From the Solution Explorer, expand the folder Views.
Double click Index.cshtml
to open it.
Replace the default code of the Index.cshtml
file with the code given below to initialize a Calendar control.
@using MVCFlexGrid.Models
@{
//create variables to set min, max and current values
var today = DateTime.Now.Date;
var minDate = new DateTime(today.Year, 1, 1);
var maxDate = new DateTime(today.Year, 12, 31);
}
<div>
//initialize a calendar control
@(Html.C1().Calendar()
//customize the control
.Value(today).Min(minDate).Max(maxDate).MonthView(true)
.Width(300)
)
</div>
type=note
Append the folder name and view name to the generated URL (for example: http://localhost:1234/Default1/index) in the address bar of the browser to see the view. Or link the view to the home page.