This is a migrated thread and some comments may be shown as answers.
Grid client template with upload control
4 Answers 115 Views
This is a migrated thread and some comments may be shown as answers.
Sharon
Top achievements
Rank 1
Sharon asked on 22 Nov 2012, 01:06 AM
I am using kendo UI web control, i tried to put the upload control inside the ajax binded grid, but it doesn't work within the client template.

Here is the code, please let me know what is the right way to do this.

Thanks in advance!

 @(Html.Kendo().Grid<DOC>()
        .Name("docGrid")
         .Columns(
        columns =>
        {
            columns.Bound(p => p.DocID).ClientTemplate("<input type='file' name='docs'/>");
            columns.Bound(p => p.RequiredDocName);
            columns.Bound(p => p.UploadStatus);
        })
       .Pageable()
       .Selectable(selectable => selectable.Mode(GridSelectionMode.Single))
       .DataSource(dataSource => dataSource
       .Ajax()

        .PageSize(30)
        .Batch(false)
        .ServerOperation(false)
        // .Events(events => events.Error("errorHandler"))
        .Model(model =>
        {
            model.Id(p => p.DocID);
            model.Field(p => p.RequiredDocName);
            model.Field(p => p.UploadStatus);
        })
        .Read(read => read.Action("Read", "WebApp"))))
</div>


<script type="text/javascript">
 
$(document).ready(function () {
    $('[name=docs]').kendoUpload(
     {
         async:
             {
                saveUrl: ......
                removeUrl: ........
                autoUpload: true
            },
            upload: onUpload,
            success: onSuccess
     });
 });

4 Answers, 1 is accepted

Sort by
0
Petur Subev
Telerik team
answered on 26 Nov 2012, 11:12 AM
Hello Sharon,

Did you try to execute the initialization script when the dataBound event of the Grid is fired? Basically the DOM ready event is executed too early for you case, since the records are still not loaded and the tr elements are not added to the Grid.

Kind Regards,
Petur Subev
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Sharon
Top achievements
Rank 1
answered on 26 Nov 2012, 06:18 PM
Hi Petur:

Thanks for the reply. I see. Do you have any examples for the initialization script in grid databound? I will try it out.

Sharon
0
Sharon
Top achievements
Rank 1
answered on 26 Nov 2012, 06:25 PM
Hi Petur:

Did you mean instead of adding the upload control in the client template, add it in the databound? Are there any examples to add columns in the databound?
Sharon
0
Sharon
Top achievements
Rank 1
answered on 26 Nov 2012, 07:51 PM
I just tried. It worked

Thanks a lot!
Tags
Grid
Asked by
Sharon
Top achievements
Rank 1
Answers by
Petur Subev
Telerik team
Sharon
Top achievements
Rank 1
Share this question
or