Skip to content

Commit 22251b2

Browse files
committed
Sync with Kendo UI Professional
1 parent 5b139fc commit 22251b2

File tree

6 files changed

+118
-55
lines changed

6 files changed

+118
-55
lines changed

docs-aspnet/_config-mvc.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ html-helpers/helper-basics/fundamentals.md,
7777
html-helpers/helper-basics/declarative-initialization.md,
7878
html-helpers/data-management/filemanager/binding/razor-page.md,
7979
html-helpers/datasource/razor-page.md,
80+
html-helpers/diagrams-and-maps/diagram/binding/razor-pages
8081
html-helpers/conversational-ui/chat/razor-page.md,
8182
html-helpers/editors/autocomplete/binding/razor-pages.md,
8283
html-helpers/editors/checkboxgroup/razor-page.md,

docs-aspnet/html-helpers/diagrams-and-maps/diagram/binding/binding.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,3 +167,6 @@ To create a network of visuals and customize the appearance of the Diagram, set
167167

168168
* [Basic Usage of the Diagram HtmlHelper for {{ site.framework }} (Demo)](https://demos.telerik.com/{{ site.platform }}/diagram)
169169
* [Server-Side API](/api/diagram)
170+
{% if site.core %}
171+
* [Diagram in Razor Pages]({% slug razorpages_diagramhelper_aspnetcore %})
172+
{% endif %}

docs-aspnet/html-helpers/diagrams-and-maps/diagram/binding/razor-pages.md

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ To enable CRUD operation in the Telerik UI Diagram within a `RazorPage`:
2222

2323
1. Setup CRUD URLs in the `DataSource` and `ConnectionsDataSource` along with a `Model.Id`. The URL in these methods must refer to the name of the method in the `PageModel`.
2424

25-
2625
```HtmlHelper
2726
.DataSource(d => d
2827
.ShapeDataSource()
@@ -100,14 +99,14 @@ To enable CRUD operation in the Telerik UI Diagram within a `RazorPage`:
10099
{% endif %}
101100
1. Add an AntiForgeryToken on top of the `RazorPage`.
102101
103-
```
102+
```cshtml
104103
@inject Microsoft.AspNetCore.Antiforgery.IAntiforgery Xsrf
105104
@Html.AntiForgeryToken()
106105
```
107106
108107
1. Send the AntiForgeryToken with each POST request of the page. Additional paratemers can also be supplied.
109108
110-
```
109+
```javascript
111110
<script>
112111
function forgeryToken() {
113112
return kendo.antiForgeryTokens();
@@ -117,7 +116,7 @@ To enable CRUD operation in the Telerik UI Diagram within a `RazorPage`:
117116
1. Within the `.cs` file, introduce ActionMethod for each of the CRUD operations.
118117
119118
120-
```
119+
```csharp
121120
public JsonResult OnPostReadShapes([DataSourceRequest] DataSourceRequest request)
122121
{
123122
return new JsonResult(DiagramShapes.ToDataSourceResult(request));
@@ -148,4 +147,8 @@ To enable CRUD operation in the Telerik UI Diagram within a `RazorPage`:
148147
149148
## See Also
150149
151-
* [Server-Side API](/api/diagram)
150+
* [Using Telerik UI for ASP.NET Core in Razor Pages](https://docs.telerik.com/aspnet-core/getting-started/razor-pages#using-telerik-ui-for-aspnet-core-in-razor-pages)
151+
* [Client-Side API of the Diagram](https://docs.telerik.com/kendo-ui/api/javascript/dataviz/ui/diagram)
152+
* [Server-Side HtmlHelper API of the Diagram](/api/diagram)
153+
* [Server-Side TagHelper API of the Diagram](/api/taghelpers/diagram)
154+
* [Knowledge Base Section](/knowledge-base)

docs-aspnet/html-helpers/editors/autocomplete/binding/razor-pages.md

Lines changed: 105 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -12,83 +12,139 @@ Razor Pages is an alternative to the MVC pattern that makes page-focused coding
1212

1313
You can seamlessly integrate the Telerik UI AutoComplete for {{ site.framework }} in Razor Pages applications.
1414

15-
This article showcases how to configure the AutoComplete component in a Razor Pages scenario.
15+
This article demonstrates how to configure the AutoComplete component in a Razor Pages scenario.
1616

1717
For the complete project, refer to the [AutoComplete in Razor Pages example](https://github.com/telerik/ui-for-aspnet-core-examples/tree/master/Telerik.Examples.RazorPages/Telerik.Examples.RazorPages/Pages/AutoComplete).
1818

1919
## Getting Started
2020

21-
In order to set up the AutoComplete component bindings, you need to configure the `Read` method of its `DataSource` instance. The URL in this method should refer the name of the method in the PageModel. In this method, you can also pass additional parameters, such as filter string and antiforgery token (see `dataFunction`).
21+
To configure the `Read` operation of the AutoComplete DataSource within a Razor Pages application, follow the next steps:
2222

23-
```tab-HtmlHelper(cshtml)
23+
1. Specify the Read operation in the DataSource configuration. The URL must refer to the method name in the PageModel.
24+
25+
```tab-HtmlHelper_Index.cshtml
26+
@page
2427
@model IndexModel
28+
@inject Microsoft.AspNetCore.Antiforgery.IAntiforgery Xsrf
29+
@Html.AntiForgeryToken()
30+
31+
<div>
32+
@(Html.Kendo().AutoComplete()
33+
.Name("autocomplete")
34+
.DataTextField("ShipName")
35+
.Filter("contains")
36+
.MinLength(3)
37+
.HtmlAttributes(new { style = "width:100%" })
38+
.DataSource(ds => ds
39+
.Custom()
40+
.Transport(transport => transport
41+
.Read(r => r
42+
.Url("/Index?handler=Read").Data("dataFunction")
43+
))
44+
.ServerFiltering(true)
45+
)
46+
)
47+
</div>
2548
49+
```
50+
{% if site.core %}
51+
```tab-TagHelper_Index.cshtml
52+
@page
53+
@model IndexModel
2654
@inject Microsoft.AspNetCore.Antiforgery.IAntiforgery Xsrf
2755
@Html.AntiForgeryToken()
56+
57+
<div>
58+
<kendo-autocomplete name="autocomplete"
59+
datatextfield="ShipName"
60+
filter="FilterType.Contains"
61+
min-length="3">
62+
<datasource type="DataSourceTagHelperType.Custom"
63+
server-filtering="true">
64+
<transport>
65+
<read url="/Index?handler=Read" data="dataFunction" />
66+
</transport>
67+
</datasource>
68+
</kendo-autocomplete>
69+
</div>
2870
29-
@(Html.Kendo().AutoCompleteFor(model => model.ShipName)
30-
.DataTextField("ShipName")
31-
.Filter("contains")
32-
.MinLength(3)
33-
.HtmlAttributes(new { style = "width:100%" })
34-
.DataSource(ds => ds
35-
.Custom()
36-
.Transport(transport => transport
37-
.Read(r => r
38-
.Url("/AutoComplete/AutoCompleteCRUDOperations?handler=Read").Data("dataFunction")
39-
))
40-
.ServerFiltering(true)
41-
)
42-
)
43-
<script>
71+
```
72+
{% endif %}
4473

74+
2. Add an `AntiForgeryToken` at the top of the page to secure the requests.
75+
76+
```cshtml
77+
@inject Microsoft.AspNetCore.Antiforgery.IAntiforgery Xsrf
78+
@Html.AntiForgeryToken()
79+
```
80+
81+
3. Send the `AntiForgeryToken` with the Read request.
82+
83+
```javascript
84+
<script>
4585
function dataFunction() {
46-
var value = $("#autocomplete").val();
4786
return {
4887
__RequestVerificationToken: kendo.antiForgeryTokens().__RequestVerificationToken,
49-
filterValue: value
88+
filterValue: $("#autocomplete").val()
5089
};
5190
}
52-
5391
</script>
5492
```
55-
{% if site.core %}
56-
```TagHelper
57-
<kendo-autocomplete for="ShipName"
58-
datatextfield="ShipName"
59-
filter="FilterType.Contains"
60-
min-length="3">
61-
<datasource type="DataSourceTagHelperType.Custom"
62-
server-filtering="true">
63-
<transport>
64-
<read url="/AutoComplete/AutoCompleteCRUDOperations? handler=Read" data="dataFunction" />
65-
</transport>
66-
</datasource>
67-
68-
</kendo-autocomplete>
93+
94+
You can also include additional parameters if needed:
95+
```javascript
96+
<script>
97+
function dataFunction() {
98+
return {
99+
__RequestVerificationToken: kendo.antiForgeryTokens().__RequestVerificationToken,
100+
filterValue: $("#autocomplete").val()
101+
};
102+
}
103+
</script>
104+
69105
```
70-
{% endif %}
71-
```tab-PageModel(cshtml.cs)
72-
public class IndexModel : PageModel
106+
107+
4. Add a handler method for the Read operation in the cshtml.cs file.
108+
109+
```tab-Index.cshtml.cs
110+
public class IndexModel : PageModel
111+
{
112+
public static List<OrderViewModel> orders;
113+
114+
public void OnGet()
73115
{
74-
[BindProperty]
75-
public string ShipName { get; set; }
76-
77-
public JsonResult OnGetRead(string filterValue)
116+
if (orders == null)
78117
{
79-
if (filterValue != null)
118+
orders = new List<OrderViewModel>();
119+
120+
Enumerable.Range(1, 50).ToList().ForEach(i => orders.Add(new OrderViewModel
80121
{
81-
//orders is the DBContext
82-
var filteredData = orders.Where(p => p.ShipName.Contains (filterValue));
83-
return new JsonResult(filteredData);
84-
}
85-
return new JsonResult(orders);
122+
ShipName = "ship name " + i
123+
}));
124+
125+
}
126+
}
127+
128+
public JsonResult OnGetRead(string filterValue)
129+
{
130+
if (filterValue != null)
131+
{
132+
var filteredData = orders.Where(p => p.ShipName.Contains(filterValue));
133+
return new JsonResult(filteredData);
86134
}
135+
return new JsonResult(orders);
87136
}
137+
}
88138
```
89139

90140
## See Also
91141

92142
* [Razor Pages Support]({% slug razor_pages_integration_aspnetmvc6_aspnetmvc %})
93-
* [DataBinding Overview]({% slug htmlhelpers_autocomplete_databinding_aspnetcore %})
143+
* [Using Telerik UI for ASP.NET Core in Razor Pages](https://docs.telerik.com/aspnet-core/getting-started/razor-pages#using-telerik-ui-for-aspnet-core-in-razor-pages)
144+
* [Client-Side API of the AutoComplete](https://docs.telerik.com/kendo-ui/api/javascript/ui/autocomplete)
145+
* [Server-Side HtmlHelper API of the AutoComplete](/api/autocomplete)
146+
{% if site.core %}
147+
* [Server-Side TagHelper API of the AutoComplete](/api/taghelpers/autocomplete)
148+
{% endif %}
149+
* [Knowledge Base Section](/knowledge-base)
94150

docs-aspnet/installation/adding-client-side-resources/ecmascript.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ Additionally, the [sourcemap](https://firefox-source-docs.mozilla.org/devtools-u
6666

6767
The following image showcases the directory structure of the loaded scripts in the **Devtools** browser:
6868

69-
![Devtools Sources Tab](/getting-started-core/images/devtools.png)
69+
![Devtools Sources Tab](../images/devtools.png)
7070

7171
### Browser Compatibility
7272

0 commit comments

Comments
 (0)