File->New>Project
And add the following line of Code. Now when I click on Employee the Details should be displayed to me
Now I need to create an Employee Controller. Before That I would like to
1 Create a Folder with View Models.
2 create a class with name “EmployeeViewModel” to add gets and sets properties.
Go to EmployeeViewModel.cs and write the following lines of Code.
public class EmployeeViewModel
{
public int Employeeno { get; set; }
public string EmployeeName { get; set; }
public string EmployeeAddress { get; set; }
public List<EmployeeViewModel> lstEmployees { get; set; }
}
Add the Reference of Kendo
And then go to Web.Config and add namespace for Kendo ( in both the web.config files)
1 which is inside View Folder
2 which is outside
<addnamespace="Kendo.Mvc.UI"/>
To Apply Styles
Go to Content Folder, all the styles related to Kendo need to be paste here.
All the scripts files related to Kendo need to be in Scripts Folder
Then go to master page (layout.cs.html) under View Folder and add the following styles and js files related to Kendo.
@Styles.Render("~/Content/css")
@Scripts.Render("~/bundles/modernizr")
<link href="@Url.Content("~/Content/Kendo/kendo.common.min.css")" rel="stylesheet"/>
<link href="@Url.Content("~/Content/Kendo/kendo.default.min.css")" rel="stylesheet"/>
<script src="@Url.Content("~/Scripts/jquery-1.7.1.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/Kendo/jquery.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/Kendo/kendo.all.min.js")" type="text/javascript"></script>
<scriptsrc="@Url.Content("~/Scripts/Kendo/kendo.aspnetmvc.min.js")" type="text/javascript"></script>
Then go to Model and Create a model with a name Employee.cs
Add-> new item
And write the following line of code in Employee.cs as below
Then go to controller folder , and select
And Click On Add button.
Write the following Method in Employee Controller as shown above.
So go to Controller and Right click on Selected Method Name i.e. (EmployeeGrid)
And select Add view
Output:
No comments:
Post a Comment
Thank you for visiting my blog