, , "Telerik ASP.NET MVC control" - , datepickers, grid, , . MVC. . , , , , , MVC.
, , MVC Model-View-Controller. Model, , , , , , Telerik, .., , , . , , , MVC. , MVC, , , "" MVC.
:
VIEW:
@model MyViewModel
<%= Html.Kendo().DateTimePickerFor(model => model.ExpirationDate)
.Name("datetimepicker")
.Value(model.ExpirationDate)
%>
VIEWMODEL: ( )
public MyViewModel() {
public DateTime ExpirationDate { get; set; }
}
CONTROLLER:
public ActionResult Index(int id)
{
var data = dataContext.SomeTable.Where(e => e.ID == id).FirstOrDefault();
MyViewModel mvm = new MyViewModel();
mvm.ExpirationDate = data.ExpirationDate;
return View(mvm);
}
Telerik / , ( ). - , , , , , , , - , , , Filterable(), . , , , DataColumns DataTable, , OnDataBound ( , ), , , , , , :
<%: Html.Kendo().Grid<Models.ViewModels.MyViewModel>()
.Name("grid")
.Columns(columns =>
{
columns.Bound(c => c.ExpirationDate).Format("MM/DD/YYYY");
})
.HtmlAttributes(new { style = "height: 380px;" })
.Scrollable()
.Sortable()
.Filterable()
.Pageable(pageable => pageable
.Refresh(true)
.PageSizes(true)
.ButtonCount(5))
.DataSource(dataSource => dataSource
.Ajax()
.Read(read => read.Action("Customers_Read", "Grid"))
.Create(create => create.Action("Customers_Create", "Grid"))
.Update(update=> update.Action("Customers_Update", "Grid"))
.Delete(delete => create.Action("Customers_Delete", "Grid"))
)
%>
"" , public ActionResult Index() public Customers_Read([DataSourceRequest] DataSourceRequest request) {}, data .ToDataSourceResult(). 3 , , , , - dataContext.SaveChanges() . , . - , .
Just take a look at the code examples here to give a better idea: http://demos.telerik.com/aspnet-mvc/