This is a migrated thread and some comments may be shown as answers.

ImageManager: Alert on 'file exists' is multiplied

1 Answer 63 Views
Editor
This is a migrated thread and some comments may be shown as answers.
snowolf
Top achievements
Rank 1
snowolf asked on 12 Apr 2011, 09:08 PM
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;
            }
        }

1 Answer, 1 is accepted

Sort by
0
Rumen
Telerik team
answered on 15 Apr 2011, 03:07 PM
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.

Tags
Editor
Asked by
snowolf
Top achievements
Rank 1
Answers by
Rumen
Telerik team
Share this question
or