This is a migrated thread and some comments may be shown as answers.

Upload duplicates items upon after selecting files

3 Answers 478 Views
Upload
This is a migrated thread and some comments may be shown as answers.
Robin
Top achievements
Rank 1
Robin asked on 24 Jul 2014, 12:36 PM
Hi sorry for duplicating my post, but I can't post a reply on my first previous post.

below are the details. Thanks.

I updated my Kendo from 1.416 to 2.716 (yes, I skipped the updates for a long time.).
So, I have this 100% working Kendo Upload(w/ v 1.416), after updating to v.2.716 the files are being duplicated after selecting items.
Codes are basic Kendo Upload async inside a tabstrip for  aspnet mvc(razor).
Please let me know if there are issues with Upload inside Tabstrip because my other Upload are working fine outside the Tabstrip.

Please refer on the sample code below.

Edit.cshtml

01.@model MyModelMain
02.@if (Model.Id != 0)
03.    {
04.        @(Html.Kendo().TabStrip()
05.          .Name("MyItems")
06.          .Items(items =>
07.          {
08.              items.Add().Text("Item1")
09.                  .Selected(true)
10.                  .Content(@<div>@Html.Action("Index", "Item1Controller", new { ItemId = Model.Id })</div>);
11.              items.Add().Text("Item2")
12.                 .Selected(false)
13.                  .Content(@<div>@Html.Action("IndexItem2", "Item2Controller", new { ItemId = Model.Id })</div>);
14.          }))
15.    }


Item2Controller.cs
01.public class Item2Controller : BaseManagementWithModelController<MainModel,long,MyModelMain,MyModelMain>
02.{
03. 
04.    /*constructor here*/
05. 
06.    public ActionResult IndexItem2(long Id)
07.    {
08.        var entity = new ItemModel();
09.        ItemViewModel model = new ItemViewModel();
10.        entity = service.Get(Id);
11.         
12.        model = mode.MapFrom(entity);
13.         
14.        return View("IndexItem2",model);
15.         
16.    }
17.}

IndexItem2.cshtml
01.@model List<ItemViewModel>
02. 
03.@(Html.Kendo().Upload()
04..Name("Item2Upload")
05. 
06..Async(x => x.AutoUpload(false)
07.    .Save("UploadImage", "Item2Controller", new RouteValueDictionary
08.                                                {
09.                                                    {Constants.ItemId, TempData[Constants.ItemId]}
10. 
11.                                                }))                                
12..Events(x => x
13.                .Select("uploadItem2Image_onSelect"
14.                .Complete("uploadItem2Image_onSuccess")
15.)
16..Multiple(true))
17. 
18.@if(Model != null && Model.Count() > 0)
19.{
20.    foreach(var itemImages in Model.OrderyBy(x => x.Id))
21.        {
22.            <img src ='@images.ImagePath' />
23.        }
24.}


I tried to duplicate the scenario on this example, but i failed.

Please see the filed attached on this for reference.

3 Answers, 1 is accepted

Sort by
0
Dimiter Madjarov
Telerik team
answered on 24 Jul 2014, 01:31 PM
Hi Robin,


  Thank you for the sample code. Nevertheless I was unable to spot any mistakes in it, that might cause the problem or anything that should differentiate Upload widgets inside a TabStrip or not.
  Is the issue observed in all browsers or only a specific one (e.g. Internet Explorer 7 might cause similar problems)?
  If possible, could you send us an isolated runnable example, that we could inspect and debug locally in order to pin point the exact reason faster (a single page with a TabStrip and Upload will be sufficient)?

I am looking forward to hearing from you.

Regards,
Dimiter Madjarov
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
0
Robin
Top achievements
Rank 1
answered on 25 Jul 2014, 10:39 AM
Hi Dimiter

I was able to replicate the scenario. Please see the attached file for the project running at VS2013.
It's performs the same to most of the browsers(IE,Chrome,Opera,Safari, etc..)

Thanks and more power to your team,
Robin
0
Dimiter Madjarov
Telerik team
answered on 25 Jul 2014, 11:16 AM
Hi Robin,


The reason for the issue is that the main page and the views rendered in the tabs are sharing the same layout page. This is why the Kendo UI scripts are loaded multiple times which is causing the Upload issue. Additionally the kendo.aspnetmvc.js file is missing and it is required when the Kendo UI MVC wrappers are used.

For simplicity I prepared a separate project to demonstrate the working scenario, that you could find attached to my post. Additionally I would suggest to check the following documentation page, which demonstrates how to correctly include Kendo UI in a Visual Studio MVC project.

I hope this information helps. I wish you a great day!

Regards,
Dimiter Madjarov
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
Tags
Upload
Asked by
Robin
Top achievements
Rank 1
Answers by
Dimiter Madjarov
Telerik team
Robin
Top achievements
Rank 1
Share this question
or