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
Then I wire it up.
But to get layoutRoundId I wire a click event
This works, but I cannot get a good event for the drop event. Also once I am inside the
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"
>
<
ItemTemplate
>
<
div
class
=
"roundSectionHeader"
>
<
span
class
=
"uploadwrapper"
data-roundid
=
"<%# Eval("
ID") %>">
<
input
type
=
"file"
ID
=
"LayoutUpload<%# Eval("
ID") %>" class="kendoFileLayout" />
</
span
>
</
div
>
</
ItemTemplate
>
</
asp:Repeater
>
Then I wire it up.
$(
".kendoFileLayout"
).kendoUpload({
async: {
saveUrl:
"../Handlers/UploadPDF.ashx"
,
removeUrl:
"../Handlers/RemovePDF.ashx"
,
autoUpload:
true
},
success: onSuccessLayout,
upload:
function
onUploadLayout(e) {
e.data = { 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