Skip to content

Commit 54c1ab6

Browse files
committed
Sync with Kendo UI Professional
1 parent 4b64a28 commit 54c1ab6

File tree

16 files changed

+292
-243
lines changed

16 files changed

+292
-243
lines changed

docs-aspnet/html-helpers/data-management/grid/faq.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -488,6 +488,7 @@ The following example demonstrates how to convert the processed data.
488488
OrderID = o.OrderID,
489489
CustomerName = o.Customer.ContactName
490490
});
491+
return Json(result);
491492
}
492493

493494
## How can I avoid circular reference exceptions?

docs-aspnet/html-helpers/editors/upload/modes-of-operation.md

Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ An Upload in the synchronous mode behaves like a regular file input—the se
4141
</form>
4242
```
4343
{% endif %}
44+
{% if site.core %}
4445
```Controller
4546
public IWebHostEnvironment WebHostEnvironment { get; set; }
4647
@@ -73,6 +74,40 @@ public ActionResult Submit(IEnumerable<IFormFile> files)
7374
return View("Result");
7475
}
7576
```
77+
{% else %}
78+
```Controller
79+
public IWebHostEnvironment WebHostEnvironment { get; set; }
80+
81+
public UploadController(IWebHostEnvironment webHostEnvironment)
82+
{
83+
WebHostEnvironment = webHostEnvironment;
84+
}
85+
86+
public ActionResult Submit(IEnumerable<HttpPostedFileBase> files)
87+
{
88+
// The Name of the Upload component is "files".
89+
if (files != null)
90+
{
91+
foreach (var file in files)
92+
{
93+
var fileContent = ContentDispositionHeaderValue.Parse(file.ContentDisposition);
94+
95+
// Some browsers send file names with full path.
96+
// The demo is interested only in the file name.
97+
var fileName = Path.GetFileName(fileContent.FileName.ToString().Trim('"'));
98+
var physicalPath = Path.Combine(WebHostEnvironment.WebRootPath, "App_Data", fileName);
99+
100+
using (var fileStream = new FileStream(physicalPath, FileMode.Create))
101+
{
102+
await file.CopyToAsync(fileStream);
103+
}
104+
}
105+
}
106+
107+
return View("Result");
108+
}
109+
```
110+
{% endif %}
76111

77112
## Asynchronous Mode
78113

@@ -97,6 +132,8 @@ An Upload in the asynchronous mode requires dedicated server handlers to store a
97132
</kendo-upload>
98133
```
99134
{% endif %}
135+
136+
{% if site.core %}
100137
```Controller
101138
public IWebHostingEnvironment WebHostEnvironment { get; set; }
102139
@@ -154,6 +191,66 @@ public ActionResult Remove(string[] fileNames)
154191
return Content("");
155192
}
156193
```
194+
{% else %}
195+
```Controller
196+
public IWebHostingEnvironment WebHostEnvironment { get; set; }
197+
198+
public UploadController(IWebHostEnvironment webHostEnvironment)
199+
{
200+
WebHostEnvironment = webHostEnvironment;
201+
}
202+
203+
public async Task<ActionResult> SaveAsync(IEnumerable<HttpPostedFileBase> files)
204+
{
205+
// The Name of the Upload component is "files".
206+
if (files != null)
207+
{
208+
foreach (var file in files)
209+
{
210+
var fileContent = ContentDispositionHeaderValue.Parse(file.ContentDisposition);
211+
212+
// Some browsers send file names with full path.
213+
// We are only interested in the file name.
214+
var fileName = Path.GetFileName(fileContent.FileName.ToString().Trim('"'));
215+
var physicalPath = Path.Combine(WebHostEnvironment.WebRootPath, "App_Data", fileName);
216+
217+
using (var fileStream = new FileStream(physicalPath, FileMode.Create))
218+
{
219+
await file.CopyToAsync(fileStream);
220+
}
221+
}
222+
}
223+
224+
// Return an empty string to signify success.
225+
return Content("");
226+
}
227+
228+
public ActionResult Remove(string[] fileNames)
229+
{
230+
// The parameter of the Remove action must be called "fileNames".
231+
232+
if (fileNames != null)
233+
{
234+
foreach (var fullName in fileNames)
235+
{
236+
var fileName = Path.GetFileName(fullName);
237+
var physicalPath = Path.Combine(WebHostEnvironment.WebRootPath, "App_Data", fileName);
238+
239+
// TODO: Verify user permissions.
240+
241+
if (System.IO.File.Exists(physicalPath))
242+
{
243+
System.IO.File.Delete(physicalPath);
244+
}
245+
}
246+
}
247+
248+
// Return an empty string to signify success.
249+
return Content("");
250+
}
251+
```
252+
{% endif %}
253+
157254

158255
### Handlers
159256

docs-aspnet/html-helpers/editors/upload/send-meta.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,23 @@ To send metadata over to the `Save()` handler:
5555
5656
4. Process the file and the associated description. The description, and any other fields of the `e.data` object, will be serialized in the `POST` request.
5757
58+
{% if site.core %}
59+
```Controller
60+
public ActionResult ChunkSave(IEnumerable<IFormFile> files, string fileDescription)
61+
{
62+
// use the files and their associated meta data
63+
}
64+
```
65+
{% else %}
66+
```Controller
67+
public ActionResult ChunkSave(IEnumerable<HttpPostedFileBase> files, string fileDescription)
68+
{
69+
// use the files and their associated meta data
70+
}
71+
```
72+
{% endif %}
73+
74+
5875
## Receiving Metadata
5976
6077
The `save` handler can sometimes produce a result that needs to be routed back to the page. The Upload requires a response in a JSON format with a `Content-Type` set to `"text/plain"`. Responses that are not empty and in a format other than JSON are treated as a server error.
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
---
2+
title: Access and remove elements from Editor's insert link popup
3+
page_title: How to access and remove elements from Editor's insert link popup?
4+
description: An example on access and remove elements from insert link popup in the Telerik UI for {{ site.product }} Editor.
5+
type: how-to
6+
slug: editor-access-link-popup-elements
7+
tags: editor, link, access
8+
res_type: kb
9+
component: editor
10+
---
11+
12+
## Environment
13+
14+
<table>
15+
<tr>
16+
<td>Product</td>
17+
<td>{{ site.product }} Editor</td>
18+
</tr>
19+
</table>
20+
21+
## Description
22+
23+
How to access and remove Tooltip label and input from Editor's insert link popup?
24+
25+
26+
## Solution
27+
28+
You have two options to achieve this requirement:
29+
30+
1. Using CSS:
31+
32+
```CSS
33+
<style>
34+
.k-editor-window #k-editor-link-title-form-label,
35+
.k-editor-window div[data-container-for="k-editor-link-title"] {
36+
display: none;
37+
}
38+
</style>
39+
```
40+
41+
2. Using javascript:
42+
```HTML
43+
@(Html.Kendo().Editor()
44+
.Name("editor")
45+
.Events(ev => ev.Execute("onExecute"))
46+
.Value(@<text>
47+
Transform this text to a link
48+
</text>)
49+
)
50+
<script>
51+
function onExecute(e) {
52+
setTimeout(function () {
53+
$("#k-editor-link-title-form-label").hide();
54+
$('div[data-container-for="k-editor-link-title"]').hide();
55+
});
56+
}
57+
</script>
58+
```
59+
60+

0 commit comments

Comments
 (0)