Help with Upload with List View (MVC 3)

3 posts, 0 answers
  1. Mark
    Mark avatar
    4 posts
    Member since:
    Jul 2012

    Posted 01 Aug 2012 Link to this post

    1. I need help with Kendo Upload. This is my problem:
    2. I have a partial view which displays a ListView of Company object. In the Edit EditorTemplate, I have a Kendo Upload control that enables the user to upload company logo. This works fine
    3. However, I need to grab the Id of the company being edited so that I can save the logo image by replacing the File Name with the Id of the company. This is what I have not being able to do.
    4. I tried using the .Events attribute, however, once I add that attribute to the upload control, the upload button turns into a regular HTML button, thus it only selects the picture, but is not able to upload it asynchronously. I have read of other solutions such as putting the upload within a form element, however since this upload is performed in ListView edit mode, I don’t see that as a good option.
    5. All I need is to be able to grab the company Id from the company Id editor field. I want to do this in the Save method of the upload control. Something like how it’s done in standard MVC controller, like: string companyName = Request.Form["CompanyName"]; How can I achieve this? 
    Thank you.
  2. Andreas
    Andreas avatar
    19 posts
    Member since:
    Oct 2010

    Posted 01 Nov 2012 Link to this post

    I have the same problem and get function onError not defined as soon as I place it inside a partial view. On regular views it works, have you found a solution.
  3. Daniel
    Daniel avatar
    2231 posts

    Posted 06 Nov 2012 Link to this post


    You can send additional data to the server by using the upload event like described in this documentation topic and the model data can be found by using the data-uid  attribute on the listview item e.g.

    function upload(e){
        var listViewItem = this.element.closest("[data-uid]"); 
        var listView =  listViewItem.closest("[data-role=listview]").data("kendoListView");
        var item = listView.dataSource.getByUid("uid")); = {
            id: item.ID

    The most likely reason for an error thrown for missing handler when used in the editor template is that the handler is added after the upload widget and it is not defined yet. If this is not causing the problem I will the code you are using or a runnable sample to check the exact setup. Regards,
    the Telerik team
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Back to Top