+1-888-365-2779
Try Now
More in this section

Forums / General Discussions / FileUploadedEvent not found

FileUploadedEvent not found

2 posts, 0 answered
  1. Venkateswarlu
    Venkateswarlu avatar
    2 posts
    Registered:
    05 Jun 2013
    07 Feb 2014
    Link to this post
    Hi sir,
    Please suggest me the below issues,
    The
    type or namespace name 'FileUploadedEventArgs' could not be found (are
    you missing a using directive or an assembly reference?)

    (1).FileUploadedEventArgs
    (2).ImageEditorLoadingEventArgs args)

    Here is my code:

    .ASPX:
    ======

    <%@ Page Title="" Language="C#" MasterPageFile="~/SameMaster.master" AutoEventWireup="true"
        CodeFile="ImageEditorSample.aspx.cs" Inherits="ImageEditorSample" %>

    <%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
    <asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
        <telerik:RadCodeBlock ID="RCB" runat="server">
            <style type="text/css">
                ._Telerik_IE9 .RadDock.rieDialogs
                {
                    z-index: 20001;
                }
                
                ._Telerik_IE9 .rcbSlide
                {
                    z-index: 20002 !important;
                }
                
                #dwndWrapper
                {
                    height: 85px;
                    background-image: url("../../images/upload_100.png");
                    background-position: left;
                    background-repeat: no-repeat;
                    padding: 15px 0 0 100px;
                }
                
                div.RadUpload .ruBrowse
                {
                    background-position: 0 -46px;
                    width: 115px !important;
                }
                
                div.RadUpload_Default .ruFileWrap .ruButtonHover
                {
                    background-position: 100% -46px !important;
                }
            </style>
        </telerik:RadCodeBlock>
        <telerik:RadScriptBlock runat="server">
            <script type="text/javascript">
                function OnClientFilesUploaded(sender, args) {
                    $find('<%=RadAjaxManager1.ClientID %>').ajaxRequest();
                }
            </script>

        </telerik:RadScriptBlock>
        <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server" EnablePageHeadUpdate="false">
            <AjaxSettings>
                <telerik:AjaxSetting AjaxControlID="RadAjaxManager1">
                    <UpdatedControls>
                        <telerik:AjaxUpdatedControl ControlID="RadImageEditor1" />
                    </UpdatedControls>
                </telerik:AjaxSetting>
            </AjaxSettings>
        </telerik:RadAjaxManager>

         <div id="dwndWrapper">
            <telerik:RadAsyncUpload ID="AsyncUpload1" runat="server"
                OnClientFilesUploaded="OnClientFilesUploaded" OnFileUploaded="fileUploaded"
                MaxFileSize="2097152" AllowedFileExtensions="jpg,png,gif,bmp"
                AutoAddFileInputs="false" Localization-Select="Upload Image" />
            <asp:Label ID="Label1" Text="*Size limit: 2MB" runat="server" Style="font-size: 10px;"></asp:Label>

        </div>
        <telerik:RadImageEditor ID="RadImageEditor1" runat="server" Width="680" Height="450"
            ImageUrl="~/js/Image-Editing.jpg" OnImageLoading="RadImageEditor1_ImageLoading">
        </telerik:RadImageEditor>
    </asp:Content>
    ====================
    ASPC.CS
    =======

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Web;
    using System.Web.UI;
    using System.Web.UI.WebControls;
    using System.IO;    
    using Telerik.Web.UI.ImageEditor;
    using System.Web.SessionState;

    public partial class ImageEditorSample : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }



        protected void fileUploaded(object sender, FileUploadedEventArgs e)
        {
            //Clear changes and remove uploaded image from Cache  FileUploadedEventArgs e)
            RadImageEditor1.ResetChanges();
            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)
        {
            //Handle Uploaded images   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;
                }
            }
        }
    }


  2. Nayden Gochev
    Nayden Gochev avatar
    32 posts
    Registered:
    03 Nov 2014
    10 Feb 2014
    Link to this post
    Hi,

    The FileUploadedEventArgs class is defined in Telerik.Web.UI Assembly.

    Regards,
    Nayden Gochev
    Telerik
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Sitefinity CMS Ideas&Feedback Portal and vote to affect the priority of the items
2 posts, 0 answered