Skip to content

Commit 5ebf663

Browse files
author
Kendo Bot
committed
Sync with Kendo UI Professional
1 parent 10b21b4 commit 5ebf663

File tree

12 files changed

+249
-114
lines changed

12 files changed

+249
-114
lines changed

docs-aspnet/html-helpers/navigation/wizard/content.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ The {{ site.product }} Wizard provides options for loading content via AJAX or d
1212

1313
## Loading Content with AJAX
1414

15-
The {{ site.product }} Wizard provides built-in support for asynchronously loading content from remote URLs via the `ContentUrl` configuration option. Those endpoints should return HTML content that will be loaded in the content area of respective step of the Wizard. When content is loaded via AJAX the Wizard allows the user to configure whether each step content will be loaded only when it is selected via the `LoadOnDemand` configuration option. Otherwise, all steps will be initially laded with the Wizard rendering. It is possible to also configure whether the step content will be reloaded on each navigation to a given Step via the `ReloadOnSelect` configuration option.
15+
The {{ site.product }} Wizard provides built-in support for asynchronously loading content from remote URLs via the `ContentUrl` configuration option. Those endpoints should return HTML content that will be loaded in the content area of respective step of the Wizard. When content is loaded via AJAX the Wizard allows the user to configure whether each step content will be loaded only when it is selected via the `LoadOnDemand` configuration option. Otherwise, all steps will be initially loaded with the Wizard rendering. It is possible to also configure whether the step content will be reloaded on each navigation to a given Step via the `ReloadOnSelect` configuration option.
1616
For a complete example, refer to the [demo on loading Wizard content with AJAX](https://demos.telerik.com/{{ site.platform }}/wizard/ajax).
1717

1818
## Loading Local Content

docs-aspnet/html-helpers/navigation/wizard/form-integration.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,11 @@ position: 2
88

99
# Form Integration
1010

11-
The {{ site.product }} Wizard can be initialized as a `<form>` element or as a `<div>` element. The configuration is set via the `.Tag()` configuration option.
11+
The {{ site.product }} Wizard provides integration with the [{{ site.product }} Form]({% slug htmlhelpers_form_aspnetcore_overview %}).
12+
13+
Each step of the Wizard accepts a `Form()` configuration method which defines the options as they are available in the {{ site.product }} Form itself. Each Form defined within the Wizard configuration will have all the functionality available in the stand-alone Form component.
14+
15+
In order to facilitate the scenarios where Forms are integrated within the Wizard, the {{ site.product }} Wizard can be initialized either from a `<form>` element or a `<div>` element. The configuration is set via the `.Tag()` configuration option.
1216

1317
## Initialization as a `<form>` Element
1418

@@ -101,6 +105,10 @@ When the {{ site.product }} Wizard is initialized as a `<div>` element any forms
101105
</script>
102106
```
103107

108+
## Separate Forms
109+
110+
Forms can be defined with the Wizard configuration (the build-in Form integration explained above), could be initialized directly as content of any step of the Wizard, or could be loaded as a content via Ajax call to a remote end-point. When Form is separately initialized (without using the Wizard configuration) or loaded as a remote content on any of the Wizard steps, there will be no built-in connection between the Wizard and the Form. The Form will act as a separate component. For further details refer to the [Content]({% slug htmlhelpers_wizard_aspnetcore_content %}) section.
111+
104112
## See Also
105113

106114
* [Basic Usage of the Wizard HtmlHelper for {{ site.framework }} (Demo)](https://demos.telerik.com/{{ site.platform }}/wizard/index)
Lines changed: 123 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,123 @@
1+
---
2+
title: Use DateTimeOffset in a DateTimePicker and Grid
3+
description: An example on how to bind a DateTimeOffset model value to a DateTimePicker and grid.
4+
type: how-to
5+
page_title: Use DateTimeOffset Model values in a DateTimePicker and Grid
6+
slug: datetimepicker-datetimeoffset-bind-to-model
7+
tags: datetimepicker, model, value, datetimeoffset, grid, filter
8+
res_type: kb
9+
---
10+
11+
## Environment
12+
13+
<table>
14+
<tr>
15+
<td>Product</td>
16+
<td>DateTimePicker for {{ site.product_long }}, Grid for {{ site.product_long }} </td>
17+
</tr>
18+
</table>
19+
20+
21+
## Description
22+
23+
The DateTimeOffset structure represents a new date-time data structure which defines a point relative to the UTC time zone. However, neither databases nor JS are able of storing this structure as is since the DateTimeOffset is serialized as an object. On the other hand, the {{ site.product_short }} components which use dates strongly depend on the JavaScript Date type API which means that they need to work with a JavaScript [Date](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date).
24+
25+
The default MVC binder is capable of binding a DateTimeOffset only if the submitted parameter is in the 2017-04-17T05:04:18.070Z format. In other words, if the {{ site.product_short }} components implement the DateTimeOffset overload, their use will be limited to only the above format or a custom binder would be required.
26+
27+
## Solution
28+
29+
Map database models with DateTimeOffset fields to view models with DateTime fields and use those view models in the UI for ASP.NET MVC and Core components. [AutoMapper](https://automapper.org/) is a popular third-party library that can map the models as shown below
30+
31+
* Install AutoMapper from NuGet Package Manager or from the package manager console:.
32+
33+
```
34+
PM> Install-Package AutoMapper
35+
```
36+
37+
{% if site.core %}
38+
Upon a successful installation, the `csproj` file should include a similar package:
39+
40+
```html
41+
<PackageReference Include="AutoMapper" Version="9.0.0" />
42+
<PackageReference Include="AutoMapper.Extensions.Microsoft.DependencyInjection" Version="7.0.0" />
43+
```
44+
{% else %}
45+
46+
Upon a successful installation, the `packages.config` file should include a similar package:
47+
48+
```html
49+
<package id="AutoMapper" version="7.0.1" targetFramework="net45" />
50+
```
51+
{% endif %}
52+
53+
* Add a Mapping profile class that inherits from `AutoMapper.Profile` and list the required mappings.
54+
55+
```MappingProfile.cs
56+
public class MappingProfile : Profile
57+
{
58+
public MappingProfile()
59+
{
60+
CreateMap<Car, CarViewModel>();
61+
CreateMap<CarViewModel, Car>();
62+
CreateMap<DateTime, DateTimeOffset>();
63+
CreateMap<DateTimeOffset, DateTime>();
64+
}
65+
}
66+
```
67+
```DataBaseModel
68+
public class Car
69+
{
70+
public DateTimeOffset ProductionDate { get; set; }
71+
}
72+
```
73+
```ViewModel
74+
public class CarViewModel
75+
{
76+
public DateTime ProductionDate { get; set; }
77+
}
78+
```
79+
```Controller
80+
using AutoMapper;
81+
82+
public class HomeController : Controller
83+
{
84+
private readonly IMapper mapper;
85+
86+
{% if site.core %}
87+
public HomeController(IMapper mapper, CarsService service)
88+
{
89+
this.mapper = mapper;
90+
this.service = service;
91+
}
92+
{% else %}
93+
public HomeController()
94+
{
95+
if(mapper == null)
96+
{
97+
var mappingConfig = new MapperConfiguration(mc =>
98+
{
99+
mc.AddProfile(new MappingProfile());
100+
});
101+
mapper = mappingConfig.CreateMapper();
102+
}
103+
}
104+
{% endif %}
105+
106+
// to bind the model to any UI for ASP.NET Date/Time picker in the Index.cshtmls view
107+
public ActionResult Index()
108+
{
109+
return View(mapper.Map<CarViewModel>(cars.FirstOrDefault()));
110+
}
111+
112+
// to use DateTimeOffset in the context of the Ajax() bound grid
113+
public ActionResult AllCars([DataSourceRequest] DataSourceRequest request)
114+
{
115+
// map the database models to the viewmodels
116+
var result = cars.Select(car => mapper.Map<CarViewModel>(car));
117+
// call the ToDataSourceResult() extension method over the mapped collection
118+
return Json(result.ToDataSourceResult(request));
119+
}
120+
}
121+
```
122+
123+
For the complete implementation refer to {% if site.core %}[this GitHub project](https://github.com/telerik/ui-for-aspnet-core-examples/tree/master/Telerik.Examples.Mvc/Telerik.Examples.Mvc/Views/DateTimeOffset).{% else %} [this GitHub project](https://github.com/telerik/ui-for-aspnet-mvc-examples/tree/master/general/DateTimeOffset).{% endif %}

docs/controls/navigation/wizard/form-integration.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,11 @@ position: 2
88

99
# Form Integration
1010

11-
The Wizard can be initialized from a `<form>` element or a `<div>` element. Forms can be defined with the Wizard configuration, could be initialized directly as content of any step of the Wizard, or could be loaded as a content via Ajax call to a remote end-point.
11+
The Wizard provides integration with the [Kendo UI Form]({% slug overview_kendoui_form_widget %}) widget.
12+
13+
Each step of the Wizard accepts a `form` configuration object which defines the options as they are available in the [Form](/api/javascript/ui/form) widget itself. Each Form defined within the Wizard configuration will have all the functionality available in the stand-alone Form component.
14+
15+
In order to facilitate the scenarios where Forms are integrated within the Wizard, the widget can be initialized either from a `<form>` element or a `<div>` element.
1216

1317
## Initialization from a `<form>` Element
1418

@@ -105,7 +109,7 @@ When the Wizard is initialized from a `<div>` element any forms initialized via
105109

106110
## Separate Forms
107111

108-
When Form is separately initialized (without using the Wizard configuration) or loaded as a remote content on any of the Wizard steps, there is no connection between the Wizard widget and the Form itself. The Form will act as a separate component. For further details refer to the [Content]({% slug content_wizard_widget %}) section.
112+
Forms can be defined with the Wizard configuration (the build-in Form integration explained above), could be initialized directly as content of any step of the Wizard, or could be loaded as a content via Ajax call to a remote end-point. When Form is separately initialized (without using the Wizard configuration) or loaded as a remote content on any of the Wizard steps, there is no connection between the Wizard widget and the Form itself. The Form will act as a separate component. For further details refer to the [Content]({% slug content_wizard_widget %}) section.
109113

110114
## See Also
111115

0 commit comments

Comments
 (0)