-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Kendo Bot
committed
Jan 15, 2019
1 parent
5c1dc68
commit bdb2540
Showing
6 changed files
with
170 additions
and
1 deletion.
There are no files selected for viewing
26 changes: 26 additions & 0 deletions
26
docs-aspnet-core/getting-started/razor-pages-integration.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
--- | ||
title: Razor Pages Integration | ||
page_title: Razor Pages Integration with Progress<sup>®</sup> Telerik<sup>®</sup> UI for ASP.NET Core | Telerik UI for ASP.NET Core | ||
description: "Razor Pages Integration with Progress Telerik UI for ASP.NET Core (aka MVC 6 or ASP.NET Core MVC)." | ||
slug: razor_pages_integration_aspnetmvc6_aspnetmvc | ||
position: 5 | ||
--- | ||
|
||
# Razor Pages Integration | ||
|
||
All Telerik UI for ASP.NET Core components are compatible with the ASP.NET Razor Pages framework. | ||
|
||
## Scaffolding Templates | ||
|
||
You can scaffold a Razor Pages sample which contains an ASP.NET Core Grid with enabled CRUD operations using our **Create New Project Wizard**. To get started with the **Create New Project Wizard**, refer to the [Creating Projects]({% slug newprojectwizards_visualstudio_aspnetcore %}) article. | ||
|
||
## Sample Applications | ||
|
||
More Razor Pages samples which demonstrate Telerik UI for ASP.NET Core components usage can be found in our [ASP.NET Core Examples](https://github.com/telerik/ui-for-aspnet-core-examples) repository. | ||
|
||
## See Also | ||
|
||
* [Get Started with Telerik UI for ASP.NET Core in ASP.NET Core Projects]({% slug gettingstarted_aspnetmvc6_aspnetmvc %}) | ||
* [Get Started with Telerik UI for ASP.NET Core in ASP.NET Core Projects with the CLI]({% slug gettingstartedcli_aspnetmvc6_aspnetmvc %}) | ||
* [Known Issues with Telerik UI for ASP.NET Core]({% slug knownissues_aspnetmvc6_aspnetmvc %}) | ||
* [Tag Helpers for ASP.NET Core]({% slug taghelpers_aspnetmvc6_aspnetmvc %}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
--- | ||
title: Send an antiforgery token with the requests of a Grid in ASP.NET Core and ASP.NET MVC projects | ||
description: An example on how to Send an antiforgery token with the requests of a Grid in ASP.NET Core and ASP.NET MVC projects. | ||
type: how-to | ||
page_title: Send an antiforgery token with the requests of a Grid in ASP.NET Core and ASP.NET MVC projects | Kendo UI Grid | ||
slug: grid-send-antiforgery-token | ||
tags: kendoui, kendo, grid, core, mvc, anti, forgery, token, antiforgery, send, antiforgerytoken | ||
res_type: kb | ||
component: grid | ||
--- | ||
|
||
## Description | ||
|
||
How can I send an antiforgery token with the requests of a Grid in ASP.NET Core and ASP.NET MVC projects? | ||
|
||
## Solution | ||
|
||
To include an antiforgery token within the requests of the grid is necessary to add an antyforgery token to the page which contains the grid and using the Transport.Data handler send the token as a parameter. | ||
|
||
``` | ||
@Html.AntiForgeryToken() | ||
@(Html.Kendo().Grid<OrderViewModel>() | ||
.Name("grid") | ||
.Groupable() | ||
.Sortable() | ||
.Editable() | ||
.Scrollable() | ||
.ToolBar(x => x.Excel()) | ||
.Columns(columns => | ||
{ | ||
columns.Bound(column => column.Freight); | ||
columns.Bound(column => column.ShipName); | ||
columns.Bound(column => column.ShipCity); | ||
columns.Command(column => | ||
{ | ||
column.Edit(); | ||
column.Destroy(); | ||
}); | ||
}) | ||
.Excel(excel => excel | ||
.FileName("Export.xlsx") | ||
.Filterable(true) | ||
.ProxyURL("/Index?handler=Save") | ||
) | ||
.DataSource(ds => ds.Ajax() | ||
.Read(r => r.Url("/Index?handler=Read").Data("forgeryToken")) | ||
.Update(u => u.Url("/Index?handler=Update").Data("forgeryToken")) | ||
.Create(c => c.Url("/Index?handler=Create").Data("forgeryToken")) | ||
.Destroy(d => d.Url("/Index?handler=Destroy").Data("forgeryToken")) | ||
.Model(m => m.Id(id => id.OrderID)) | ||
.PageSize(10) | ||
) | ||
.Pageable() | ||
) | ||
<script> | ||
function forgeryToken() { | ||
return kendo.antiForgeryTokens(); | ||
} | ||
</script> | ||
``` | ||
|
||
## Notes | ||
|
||
The [kendo.antiforgerytokens](https://docs.telerik.com/kendo-ui/api/javascript/kendo/methods/antiforgerytokens) method returns an object that contains common CSRF tokens found on the page. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
(function() { | ||
|
||
var Calendar = kendo.ui.Calendar, | ||
instance, | ||
div; | ||
|
||
describe("kendo.ui.Calendar selection", function () { | ||
beforeEach(function() { | ||
|
||
div = $("<div />").appendTo(Mocha.fixture); | ||
}); | ||
afterEach(function() { | ||
|
||
instance.destroy(); | ||
kendo.destroy(Mocha.fixture); | ||
}); | ||
|
||
$.fn.press = function(x, y, ctrlKey, metaKey) { | ||
return triggerEvent(this, "mousedown", { | ||
pageX: x, | ||
pageY: y, | ||
ctrlKey: ctrlKey, | ||
metaKey: metaKey | ||
}); | ||
}; | ||
|
||
$.fn.move = function(x, y, ctrlKey, metaKey) { | ||
return triggerEvent(this, "mousemove", { | ||
pageX: x, | ||
pageY: y, | ||
ctrlKey: ctrlKey, | ||
metaKey: metaKey | ||
}); | ||
}; | ||
|
||
$.fn.tap = function(info) { | ||
return triggerEvent(this, "click", info); | ||
}; | ||
|
||
$.fn.release = function(info) { | ||
info = $.extend({}, info); | ||
return triggerEvent(this, "mouseup", info); | ||
}; | ||
|
||
function triggerEvent(element, type, info) { | ||
element.trigger($.Event(type, info)); | ||
|
||
return element; | ||
}; | ||
|
||
it("disabled dates are not selected with drag to select", function() { | ||
instance = new Calendar(div, { | ||
selectable: "multiple", | ||
disableDates: ["we"] | ||
}), | ||
selectable = instance.selectable, | ||
firstSelectee = $(instance.element.find("tr:eq(2) td:has(.k-link)")[0]), | ||
secondSelectee = instance.element.find("tr:eq(3) td:has(.k-link)").last(), | ||
position = secondSelectee.offset(); | ||
|
||
firstSelectee.tap().press().move(position.left, position.top).release(); | ||
|
||
assert.isOk(instance.element.find("td.k-state-selected").length); | ||
assert.isOk(!instance.element.find("td.k-state-selected.k-state-disabled").length); | ||
}); | ||
|
||
}); | ||
}()); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters