ImageManager: Alert on 'file exists' is multiplied

2 posts, 0 answers
  1. snowolf
    snowolf avatar
    24 posts
    Member since:
    Oct 2007

    Posted 12 Apr 2011 Link to this post

    in the Editor, click on the Image Manager tool, then click "Upload",
    uncheck "Overwrite if file exists?".
    If I upload three existing files, I get an alert dialog with three times of "A file with a name same as the target already exists!".

    Is there a way to only display one error message "A file with a name same as the target already exists!"?

    I found a post and it seems like the solution doesn't work for me or maybe I miss something.
    http://www.telerik.com/community/forums/aspnet-ajax/file-explorer/alert-on-file-exists-is-multiplied-with-the-number-of-uploads.aspx

    I'm using custom control which inherited from RadEditor.
    I tried to add the following code in the custom control, but rfe is always null.

    protected override void EnsureChildControls()
    ......
    Telerik.Web.UI.RadFileExplorer rfe =
                    (Telerik.Web.UI.RadFileExplorer)this.FindRadControl(this.Page);
                if (rfe != null)
                {
                    rfe.ItemCommand += new RadFileExplorerEventHandler(radFileExplorer_ItemCommand);
                }
    }

    private Control FindRadControl(Control parent)
            {
                foreach (Control c in parent.Controls)
                {
                    if (c is Telerik.Web.UI.RadFileExplorer) return c;
                    if (c.Controls.Count > 0)
                    {
                        Control sub = FindRadControl(c);
                        if (sub != null) return sub;
                    }
                }
                return null;
            }

    protected void radFileExplorer_ItemCommand(object sender, RadFileExplorerEventArgs e)
            {
                switch (e.Command)
                { 
                    case "UploadFile":
                        //should I check the existence here?
                        break;
                    default:
                        break;
                }
            }
  2. Rumen
    Admin
    Rumen avatar
    13804 posts

    Posted 15 Apr 2011 Link to this post

    Hi Snowolf,

    You can see how to get a reference to the RadUpload control in the Upload dialog of the Image manager in this KB article: Displaying single upload control in the FileBrowser Upload manager.

    Best regards,
    Rumen
    the Telerik team

    Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

Back to Top