Skip to content

Commit b7d6c2c

Browse files
author
Kendo Bot
committed
Sync with Kendo UI Professional
1 parent 1e5d079 commit b7d6c2c

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

61 files changed

+451
-247
lines changed

docs-aspnet-core/_config.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ url: "https://docs.telerik.com/aspnet-core"
33

44
all_pages_domain: "https://docs.telerik.com"
55

6+
capital_casing_redirects: true
7+
68
# Exclude files which should not be in the output
79
exclude: [README.md, Gemfile, Gemfile.lock,api_sort.rb, Dockerfile, bs-config.js, build-docs.sh, copy_content.sh, copy_local.sh, docs-watcher/*, exclude_files.txt, install-npm.sh, start-docs.sh, watch.sh]
810
exclude_navigation: ["knowledge-base/*"]
47.5 KB
Loading
38.3 KB
Loading
145 KB
Loading
13 KB
Loading
Lines changed: 213 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,213 @@
1+
---
2+
title: Scaffolding
3+
page_title: Scaffolding | Progress Telerik UI for ASP.NET Core
4+
description: "Learn how to use the Kendo UI Scaffolder extensions."
5+
slug: scaffolding_aspnetcore
6+
position: 4
7+
---
8+
9+
# Scaffolding
10+
11+
As of the R1 2019 release, Telerik UI for ASP.NET Core provides Scaffolding templates.
12+
13+
They allow you to use the standard scaffolding to generate MVC-helper declarations for editors that use the Telerik UI for ASP.NET Core components instead of standard inputs.
14+
15+
You can use them in both MVC views and Razor Pages.
16+
17+
Depending on the type of field, the following editors will be generated:
18+
19+
* `String`: `input` element with Kendo styles
20+
* `String` (multiline): `textarea` element with Kendo styles
21+
* `Number`: `kendo-numerictextbox` tag helper
22+
* `DateTime`: `kendo-datetimepicker` tag helper
23+
* `Boolean`: `Html.Kendo().CheckBoxFor` helper
24+
25+
The scaffolding logic and tools are the same as with the ordinary .NET Core web applications. The main repository and logic for the scaffolding provided by Microsoft is [https://github.com/aspnet/Scaffolding](https://github.com/aspnet/Scaffolding). The original template files are located in its: [https://github.com/aspnet/Scaffolding/tree/master/src/VS.Web.CG.Mvc/Templates](https://github.com/aspnet/Scaffolding/tree/master/src/VS.Web.CG.Mvc/Templates) folder.
26+
27+
In order to use the scaffolding provided by Microsoft you can follow these resources:
28+
29+
- [Add a model to an ASP.NET Core MVC app](https://docs.microsoft.com/en-us/aspnet/core/tutorials/first-mvc-app/adding-model?view=aspnetcore-2.1)
30+
- [Add a model to a Razor Pages app in ASP.NET Core](https://docs.microsoft.com/en-us/aspnet/core/tutorials/razor-pages/model?view=aspnetcore-2.1)
31+
32+
33+
>tip The Scaffolding features allow you to generate templates based on classes and are different than the editor templates used by widgets like the grid for editing records. If you are looking for the editor templates, you can find them in your installation folder under `C:\Program Files (x86)\Progress\Telerik UI for ASP.NET Core <your version>\wrappers\aspnetcore\EditorTemplates`.
34+
35+
## Getting Started
36+
37+
38+
### Requirements
39+
40+
Make sure that Telerik UI for ASP.NET Core is installed and set up in your project. There are two ways to do that:
41+
42+
* [Use Visual Studio](https://docs.telerik.com/aspnet-core/getting-started/getting-started)
43+
* [Use the CLI](https://docs.telerik.com/aspnet-core/getting-started/getting-started-cli)
44+
45+
### Installation
46+
47+
To install the UI for ASP.NET Core Scaffolding templates and extensions in your project:
48+
49+
1. Clone or Download the [https://github.com/telerik/scaffold-templates-core](https://github.com/telerik/scaffold-templates-core) repository.
50+
51+
1. Copy the `Templates` folder from the repo above to the **root** of your project.
52+
53+
1. Exclude it from the project to make sure it will not be compiled when building. There are two ways to do that:
54+
55+
* add the following to the project file directly:
56+
57+
```.csproj
58+
<ItemGroup>
59+
<Compile Remove="Templates\**" />
60+
<Content Remove="Templates\**" />
61+
<EmbeddedResource Remove="Templates\**" />
62+
<None Remove="Templates\**" />
63+
</ItemGroup>
64+
```
65+
66+
* OR, use the GUI in Visual Studio:
67+
68+
**Figure 1. Exclude the Templates folder from compilation**
69+
70+
![Exclude Templatse folder](images/exclude-templates-from-project-GUI.png)
71+
72+
73+
### Use With Visual Studio
74+
75+
The Kendo UI Scaffolding Templates pertain to cshtml generation, so you must first create the appropriate model and controller as per your applicaiton needs. You can use the standard Scaffolding, or code you already have.
76+
77+
If you don't have a model and controller already, below the list you can find a sample set so you can follow this example.
78+
79+
To add a View that will use a Kendo scaffolded template:
80+
81+
1. Select **Add** > **New Scaffolded Item...** from the context menu of the desired location.
82+
83+
**Figure 2. Add Scaffolded Item**
84+
85+
![Add Scaffolded Item](images/add-scaffolded-item.png)
86+
87+
1. Choose item type (for example, **MVC View**) and click **Add**
88+
89+
**Figure 3. Add Scaffolded View**
90+
91+
![Add Scaffolded View](images/add-scaffolded-view.png)
92+
93+
1. Set the View properties (name, template and model to match the code you already have) and click **Add**. For example, an `Edit` view for the `SampleScaffoldingData` model.
94+
95+
**Figure 3. Set View Properties**
96+
97+
![Set View Properties](images/set-scaffolded-view-properties.png)
98+
99+
After following the steps, you should have something similar to the following in your project. You can also use the sample class and controller to test the behavior with dummy data instead of actual models.
100+
101+
```Model
102+
using System;
103+
using System.Collections.Generic;
104+
using System.ComponentModel.DataAnnotations;
105+
using System.Linq;
106+
using System.Threading.Tasks;
107+
108+
namespace SampleCoreApp.Models
109+
{
110+
public class SampleScaffoldingData
111+
{
112+
public string SingleLineString { get; set; }
113+
[DataType(DataType.MultilineText)]
114+
public string MultiLineString { get; set; }
115+
public int SomeNumber { get; set; }
116+
public DateTime SomeDate { get; set; }
117+
public bool SomeBoolean { get; set; }
118+
}
119+
}
120+
```
121+
```View
122+
@model SampleCoreApp.Models.SampleScaffoldingData
123+
124+
@{
125+
ViewData["Title"] = "Edit";
126+
}
127+
128+
<h1>Edit</h1>
129+
130+
<h4>SampleScaffoldingData</h4>
131+
<hr />
132+
<div class="row">
133+
<div class="col-md-4">
134+
<form asp-action="Edit" id="SampleScaffoldingDataForm">
135+
<div asp-validation-summary="ModelOnly" class="text-danger"></div>
136+
<div class="form-group">
137+
<label asp-for="SingleLineString"></label>
138+
<input asp-for="SingleLineString" class="k-textbox" />
139+
<span asp-validation-for="SingleLineString" class="text-danger k-invalid-msg" data-for="SingleLineString"></span>
140+
</div>
141+
<div class="form-group">
142+
<label asp-for="MultiLineString"></label>
143+
<textarea asp-for="MultiLineString" class="k-textbox"></textarea>
144+
<span asp-validation-for="MultiLineString" class="text-danger k-invalid-msg" data-for="MultiLineString"></span>
145+
</div>
146+
<div class="form-group">
147+
<label asp-for="SomeNumber"></label>
148+
<kendo-numerictextbox for="SomeNumber" />
149+
<span asp-validation-for="SomeNumber" class="text-danger k-invalid-msg" data-for="SomeNumber"></span>
150+
</div>
151+
<div class="form-group">
152+
<label asp-for="SomeDate"></label>
153+
<kendo-datetimepicker for="SomeDate" />
154+
<span asp-validation-for="SomeDate" class="text-danger k-invalid-msg" data-for="SomeDate"></span>
155+
</div>
156+
<div class="form-group">
157+
@Html.Kendo().CheckBoxFor(m => m.SomeBoolean)
158+
<label asp-for="SomeBoolean"></label>
159+
<span asp-validation-for="SomeBoolean" class="text-danger k-invalid-msg" data-for="SomeBoolean"></span>
160+
</div>
161+
<div class="form-group">
162+
<input type="submit" value="Save" class="k-button k-primary" />
163+
</div>
164+
</form>
165+
</div>
166+
</div>
167+
168+
<div>
169+
<a asp-action="Index" class="k-button">Back to List</a>
170+
</div>
171+
```
172+
```Controller
173+
using System;
174+
using System.Collections.Generic;
175+
using System.Linq;
176+
using System.Threading.Tasks;
177+
using Microsoft.AspNetCore.Http;
178+
using Microsoft.AspNetCore.Mvc;
179+
using SampleCoreApp.Models;
180+
181+
namespace SampleCoreApp.Controllers
182+
{
183+
public class TestScaffoldingController : Controller
184+
{
185+
//the rest of the controller is omitted for brevity
186+
187+
// GET: TestScaffolding/Edit/5
188+
public ActionResult Edit(int id)
189+
{
190+
SampleScaffoldingData sampleData = new SampleScaffoldingData() {
191+
MultiLineString = string.Format("{0}\n{1}", id, id + 1),
192+
SingleLineString = id.ToString(),
193+
SomeBoolean = id % 3 == 0,
194+
SomeDate = DateTime.Now,
195+
SomeNumber = id
196+
};
197+
198+
return View(sampleData);
199+
}
200+
}
201+
}
202+
```
203+
204+
205+
## See Also
206+
207+
* [Add the Kendo components to Your Project with VS 2017](https://docs.telerik.com/aspnet-core/getting-started/getting-started)
208+
* [Add the Kendo components to Your Project with the CLI](https://docs.telerik.com/aspnet-core/getting-started/getting-started-cli)
209+
* [ASP.NET Scaffolding](https://github.com/aspnet/Scaffolding)
210+
* [Default ASP.NET Scaffolding Templates](https://github.com/aspnet/Scaffolding/tree/master/src/VS.Web.CG.Mvc/Templates)
211+
* [UI for ASP.NET Core Scaffolding Templates](https://github.com/telerik/scaffold-templates-core)
212+
* [Tutorial: How to add a model to an ASP.NET Core MVC app](https://docs.microsoft.com/en-us/aspnet/core/tutorials/first-mvc-app/adding-model?view=aspnetcore-2.1)
213+
* [Tutorial: How to add a model to a Razor Pages app in ASP.NET Core](https://docs.microsoft.com/en-us/aspnet/core/tutorials/razor-pages/model?view=aspnetcore-2.1)

docs-aspnet-mvc/_config.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ url: "https://docs.telerik.com/aspnet-mvc"
33

44
all_pages_domain: "https://docs.telerik.com"
55

6+
capital_casing_redirects: true
7+
68
# Exclude files which should not be in the output
79
exclude: [README.md, Gemfile, Gemfile.lock,api_sort.rb, Dockerfile, bs-config.js, build-docs.sh, copy_content.sh, copy_local.sh, docs-watcher/*, exclude_files.txt, install-npm.sh, start-docs.sh, watch.sh]
810
exclude_navigation: [asp-net-mvc-3.html,asp-net-mvc-4.html]

docs-aspnet-mvc/helpers/datepicker/how-to/masked-date-picker-grid.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@ slug: howto_create_masked_datepickers_datepickaspnetmvc
99

1010
The following example demonstrates how to add a mask to the Kendo UI DatePicker through a custom Kendo UI widget.
1111

12+
> **Important**
13+
>
14+
> This approach is not officially supported and might lead to undesired side-effects. As of the Kendo UI R2 2017 release, the DatePicker supports the [`dateInput`](/api/javascript/ui/datepicker/configuration/dateinput) property which provides a built-in mask.
15+
1216
###### Example
1317

1418
```html

docs/AngularJS/angular-hybrid.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -139,8 +139,6 @@ The hybrid mobile widgets may be configured via the `k-` prefixed attributes. Fo
139139

140140
## See also
141141

142-
Other articles on the integration of Kendo UI hybrid components:
143-
144142
* [Integration with Kendo UI for the Web]({% slug integrationkendouiweb_hybridkendoui %})
145143
* [MVVM Integration]({% slug mvvmintegration_hybridkendoui %})
146144
* [Build Applications with AngularJS and the Hybrid UI]({% slug buildappswithangular_tutorial_hybridkendoui %})

docs/AngularJS/data-source.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,8 +119,6 @@ The reason behind this is the fact that when grid columns do not declare a templ
119119

120120
## See Also
121121

122-
Other articles on AngularJS directives and integration with Kendo UI:
123-
124122
* [AngularJS Integration Overview]({% slug angularjs_integration_directives %})
125123
* [Global Events]({% slug global_events_angularjs_directives %})
126124
* [Grid Settings]({% slug grid_settings_angularjs_directives %})

0 commit comments

Comments
 (0)