MVC 4 Telerik Upload in jQuery Dialog - removing file causes control to
disappear
As title states I have Telerik Upload control in jQuery Dialog. It works
fine in IE, but in Chrome/FF after uploading file and removing it (from
control, not HDD) whole control disappears. It's not even in DOM anymore.
To reproduce:
Put Upload control in jQuery dialog.
Open dialog and upload some file.
After file is uploaded remove it from Upload.
Watch whole Upload control disappear.
Here's my Upload code:
Html.Telerik().Upload()
.Localizable("pl-PL")
.Name("attachments")
.Multiple(true)
.ClientEvents(evetns =>
{
evetns.OnError("onError");
evetns.OnSuccess("onSuccess");
evetns.OnUpload("onUpload");
})
.Async(async => async
.Remove("UsunZalacznik", "Zalaczniki")
.Save("ZapiszZalaczniki", "Zalaczniki")
.AutoUpload(true))
And here's my remove action:
foreach (string fileName in fileNames)
{
SessionHelper.RemoveFromAttachments(name: fileName);
}
return Content("");
And code for RemoveFromAttachments:
var session = HttpContext.Current.Session["attachments"] as
List<UploadedFile>;
if (session != null && session.Count > 0)
{
if (id > 0) session.RemoveAll(x => x.Id == id);
else session.RemoveAll(x => x.Name == name);
HttpContext.Current.Session["attachments"] = session;
}
No comments:
Post a Comment