Keep RadWindow open after completing server site event

2 posts, 1 answers
  1. Pankaj
    Pankaj avatar
    1 posts
    Member since:
    Nov 2013

    Posted 14 Feb 2014 Link to this post

    I am using RadWindow which contains RadAsyUpload in update panel , image control and button when i select image in RadasyUpload image get uploaded and preview is displaying in image control, but problem is that when image uploaded RadWindow get close and to view image i have to open Radwindow again , how could i keep open RadWindow after displaying image and close it when i click on close button
  2. Answer
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 16 Feb 2014 in reply to Pankaj Link to this post

    Hi Pankaj,

    Please have a look into the following sample code snippet which works fine at my end.

    <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server" EnablePageHeadUpdate="false">
    <telerik:RadWindow ID="Radwindow1" runat="server" VisibleOnPageLoad="true">
            <asp:UpdatePanel ID="UpdatePanel1" runat="server">
                    <telerik:RadAsyncUpload ID="AsyncUpload1" runat="server"    OnClientFilesUploaded="OnClientFilesUploaded" OnFileUploaded="AsyncUpload1_FileUploaded"    AllowedFileExtensions="jpg,png,gif,bmp" />
                    <telerik:RadImageEditor ID="RadImageEditor1" runat="server" Width="680"   Height="450"  ImageUrl="~/Images/350chev_conrod265_76.jpg" OnImageLoading="RadImageEditor1_ImageLoading">

    <script type="text/javascript">
        function OnClientFilesUploaded(sender, args) {
            $find('<%=RadAjaxManager1.ClientID %>').ajaxRequest();

    protected void AsyncUpload1_FileUploaded(object sender, FileUploadedEventArgs e)
        Context.Cache.Remove(Session.SessionID + "UploadedFile");
        using (Stream stream = e.File.InputStream)
            byte[] imgData = new byte[stream.Length];
            stream.Read(imgData, 0, imgData.Length);
            MemoryStream ms = new MemoryStream();
            ms.Write(imgData, 0, imgData.Length);
            Context.Cache.Insert(Session.SessionID + "UploadedFile", ms, null, DateTime.Now.AddMinutes(20), TimeSpan.Zero);
    protected void RadImageEditor1_ImageLoading(object sender, ImageEditorLoadingEventArgs args)
        if (!Object.Equals(Context.Cache.Get(Session.SessionID + "UploadedFile"), null))
            using (EditableImage image = new EditableImage((MemoryStream)Context.Cache.Get(Session.SessionID + "UploadedFile")))
                args.Image = image.Clone();
                args.Cancel = true;

  3. DevCraft R3 2016 release webinar banner
Back to Top