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

Upload in Grid Custom Editor

8 Answers 3278 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Cyndie
Top achievements
Rank 1
Cyndie asked on 30 May 2012, 09:39 PM
Is it possible to put an upload widget in the Custom Editor for an editable grid with a CRUD datasource to a web service? 

Here is my concept:
I'd like to have a grid that has columns for a description of a document, who uploaded it, the date uploaded/edited and a link to the uploaded file.  With Create in the toolbar, they could add a new record or edit a row to upload an newer version of the file.  The upload widget would be in the column with the link to the uploaded file.

8 Answers, 1 is accepted

Sort by
0
Iliana Dyankova
Telerik team
answered on 31 May 2012, 02:12 PM
Hello Cyndie,

I am not sure if I understand your scenario correctly, but if you would like to include the upload widget to the column of the Kendo UI Grid you could check the following forum thread with a similar subject.

If this is not your case, please provide more detailed information about your scenario.

Kind regards,
Iliana Nikolova
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Cyndie
Top achievements
Rank 1
answered on 31 May 2012, 02:26 PM
Thank you for your response.  I saw that example, but I think what I'm hoping for is a little more complex.  The difference is that I'd like to use an editable grid using remote data and have the upload widget as an edit template, with a link to the uploaded file when not editing. 

in view mode
column1, column2, column3, column4
value        value      value       hyperlink to uploaded file

in edit mode
column1, column2, column3, column4
textbox    textbox    textbox    upload widget

I'm not sure how to integrate the upload widget with a datasource to a web service.

Thanks again.
0
Cyndie
Top achievements
Rank 1
answered on 31 May 2012, 07:56 PM
I tried to use an async upload widget in a custom editor and receive the following error:
Microsoft JScript runtime error: Object doesn't support property or method 'value'
at line 7280 in kendo.web.js

function fileUploadEditor(container, options) {
        $('<input type="file" id="files" name="files" />')
        .appendTo(container)
        .kendoUpload({
            async:{
                saveUrl: "http://rces-web/rcesonly/oandt/OandtWebService.asmx/UploadFile",
                autoUpload: true
            }
        });
    }

0
Cyndie
Top achievements
Rank 1
answered on 01 Jun 2012, 03:51 PM
Can I add an async upload via a template as in this example?
http://www.kendoui.com//forums/ui/grid/custom-popup-editor-with-additional-fields.aspx

I set data-role to upload and get the kendo styled uploader, but do not know how to specify the async saveUrl from html.  If I can get that to work, it would resolve my issue.
0
Cyndie
Top achievements
Rank 1
answered on 01 Jun 2012, 04:26 PM
Okay, I finally figured this out:

<input name="files" id="files" type="file" data-role="upload" data-async='{"saveUrl":"http://rces-web/rcesonly/oandt/OandtWebService.asmx/UploadFile", "autoUpload":"true"}'/>
0
Cyndie
Top achievements
Rank 1
answered on 15 Jun 2012, 07:16 PM
I have found that this works, except in the case when a user clicks edit, then uploads a new file and does not change anything else.  If that happens, the update does not trigger.
0
Iliana Dyankova
Telerik team
answered on 20 Jun 2012, 02:28 PM
Hello Cyndie,

To save the new uploaded file, you should hook up the upload success event. Hence, in the grid save event set the file name to the dataSource via the model. Please keep it in mind that to enable the editing support of KendoUI Grid widget you should configure the DataSource for remote CRUD data operations and define the DataSource schema

For convenience, I created a simple project which illustrates such approach in action.
 
Regards,
Iliana Nikolova
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
krishna
Top achievements
Rank 1
answered on 19 Feb 2015, 06:44 AM
hello Cyndie ! Could u plz post the '.cs' and '.cshtml' code for the same ! i am looking for similar kind of stuff actually. Thanks :)
Tags
Grid
Asked by
Cyndie
Top achievements
Rank 1
Answers by
Iliana Dyankova
Telerik team
Cyndie
Top achievements
Rank 1
krishna
Top achievements
Rank 1
Share this question
or