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

Where are my parents? (Passing context data to a file upload)

0 Answers 34 Views
This is a migrated thread and some comments may be shown as answers.
Top achievements
Rank 1
Jeremy asked on 12 Sep 2012, 10:06 PM
I have many KendoFile controls that are dynamically created using a loop.  They all work, and upload files.  But for each one I need to know their unique ID (which I pass back to the handler).  However when the upload event fires I can't seem to traverse to find parents.

So the way I get the ID now is to register a click event, and put the val into a global variable.  This works for normal uploads.  But it all fails for drag and drop.

First I write one upload control per round
<asp:Repeater ID="Repeater1" runat="server">
        <div class="roundSectionHeader">
            <span class="uploadwrapper" data-roundid="<%# Eval("ID") %>">
                <input type="file" ID="LayoutUpload<%# Eval("ID") %>" class="kendoFileLayout" />

Then I wire it up.
    async: {
        saveUrl: "../Handlers/UploadPDF.ashx",
        removeUrl: "../Handlers/RemovePDF.ashx",
        autoUpload: true
    success: onSuccessLayout,
    upload: function onUploadLayout(e) { = { jobid: pageValues.jobId, jobroundid: layoutRoundId, fullname: globalValues.fullName };

But to get layoutRoundId I wire a click event

$(".uploadwrapper").click(function () {
    layoutRoundId = $(this).data("roundid");

This works, but I cannot get a good event for the drop event.  Also once I am inside the kendoUpload event I seem to lose context and cannot reference parents or siblings

No answers yet. Maybe you can help?

Asked by
Top achievements
Rank 1
Share this question