It's our Enterprise app, so cant update it here.
Our Master Page has a Script Manager, so I didnt use another scriptmanager for Radcontrols in my aspx page.
Here is my scriptmanager piece in Master page.
<asp:ScriptManager ID="ScriptManagerMain" runat="server" EnablePageMethods="true"
EnablePartialRendering="true" EnableHistory="true" EnableSecureHistoryState="False" AsyncPostBackTimeout="300">
Here is the control I have in my aspx page.
<telerik:RadAsyncUpload runat="server" ID="RadAsyncUpload1" HttpHandlerUrl="~/FileUpload/FileUpload.ashx"
OnClientFileUploaded="fileUploaded" OnClientFileUploadRemoving="fileUploadRemoving"
MultipleFileSelection="Disabled" AllowedFileExtensions="jpeg,jpg,gif,png,bmp" Width="500px" />
<div class="imageContainer"></div>
Here is the Javascript file.
(function () {
var $;
var demo = window.demo = window.demo || {};
demo.initialize = function () {
$ = $telerik.$;
};
window.fileUploaded = function (sender, args) {
var id = args.get_fileInfo().ImageID;
$(".imageContainer")
.html("")
.append($("<img />")
.attr("src", getImageUrl(id)));
$(".info").html(String.format("<strong>{0}</strong> successfully inserted.<p>Record ID - {1}</p>", args.get_fileName(), id));
};
window.getImageUrl = function (id) {
var url = window.location.href;
var handler = "FileQuery.ashx?imageID=" + id;
var index = url.lastIndexOf("/");
var completeUrl = url.substring(0, index + 1) + handler;
return completeUrl;
};
window.fileUploadRemoving = function (sender, args) {
var index = args.get_rowIndex();
$(".imageContainer img:eq(" + index + ")").remove();
};
})();