I am using a Kendo upload to save files to my server. However, I would like to send the files to a C# web method in a web service where I then perform the code that saves the files to the server.
I am having difficulty when trying to call my web method.
Here is what I have:
[WebMethod]
//Saves attachment files to server
public string UploadAttachments(IEnumerable<HttpPostedFileBase> files)
{
string returnMessage = "Copying Attachments...";
try
{
// The Name of the Upload component is "files"
if (files != null)
{
foreach (var file in files)
{
// Some browsers send file names with full path.
// We are only interested in the file name.
var fileName = Path.GetFileName(file.FileName);
var physicalPath = Path.Combine(Server.MapPath("~/App_Data/Attachments"), fileName);
file.SaveAs(physicalPath);
}
}
}
catch (Exception e)
{
returnMessage = "Fail";
}
return returnMessage;
} //End
Here is the upload input on my webpage and the javascript I am using:
<h2>Attachments:</h2>
<input id="files" type="file" name="files" />
<script>
//when adding attachments
$(document).ready(function () {
$("#files").kendoUpload({
async: {
saveUrl: "../WebService.asmx/UploadAttachments",
removeUrl: "remove",
multiple: true,
autoUpload: true
}
});
});
</script>
I cannot get it to call my method when trying to pass the "IEnumerable<HttpPostedFileBase> files" , but it will hit the method if I take that part out, but then I cannot perform the rest of the code within the method.
Currently, when I try to upload a file, it automatically says it has failed and never calls my web method.
Am I missing a step somewhere?
Hi All,
I started my journey with Kendo MVVM today and immediately I faced this problem. I have view contains div with nested divs. It looks like:
<div id="splitter" class="vsm-splitter" data-role="splitter" data-panes="[ { collapsible: true, min: '640px', size: '50%', scrollable: false }, { collapsible: false, min: '300px' }, { collapsible: true, min: '320px', size: '25%' }]" data-bind="visible: isVisible"> <div> @Html.Partial("widget1") </div> <div> @Html.Partial("widget2") </div> <div> @Html.Partial("widget3") </div></div>Parent div should be bound to splitter and children divs to widgets. We want to have view model for splitter which is very simple:
var vm = kendo.observable({ isVisible: true });and have separated view model for each component and bind them one by one. So code can look like that:
kendo.bind($('#splitter'), vm);kendo.bind($('#widget1Root'), vmW1);kendo.bind($('#widget2Root'), vmW2);kendo.bind($('#widget3Root'), vmW3);but it causes following error:
Uncaught TypeError: undefined has no propertiesWhen I replace Partial with static text it works ok. Do you know how I can proceed with that kind of issue? Any suggestion?
Best Regards,
Mateusz
We are using a ScrollView bound to a local data source that is configured to show multiple items per page. I ran into an issue today where it looked like the ScrollView was not refreshing its contents after an item in the data source had been updated via .set(). However, I discovered purely by accident that if you scroll two pages to the right and then scroll back two pages to the left, the ScrollView will have magically picked up your changes and re-rendered the items. I've put together a Fiddle that demonstrates this behavior:
If you push the "Make Yellow" button, nothing seems to happen even though the data source has been properly updated. If you then swipe from the right twice, and then to the left, you will see what I'm talking about. This looks like a bug in the ScrollView, is there any other workaround besides re-setting the data source (I haven't tried this yet)?
You can see this but in your own demo: http://demos.telerik.com/kendo-ui/datepicker/index
In the first DateTimePicker, for "Show e-mails from:" enter the following for the date:
12/31/20000003
Now, tab out of the DateTimePicker box. It re-formats the date to "12/31/2000" which, in my opinion, is great.
However, if you enter this date, it doesn't have the same behavior:
12/31/21000003
We are seeing this same behavior in our use of the control, and would like it to behave consistently. Any advice on how to get that to work?
When I export the scheduler to PDF it does not show the whole calendar but only the part that is visible without scrolling. Does the scheduler support something similar to the Kendo Grid's allPages attribute? I tried adding "addPages: true" to the the Pdf object in the scheduler configuration but it did not work. If this functionality is not supported at this time is there an ETA on when this functionality will be available? Is there a current work around that you might suggest?
Thanks in advance.
hi!
I have 20 series, 10 of group "A" and 10 of group "B"
Is this possible?
best regards, markus