New to Telerik UI for ASP.NET AJAX? Start a free 30-day trial
Select an image or a folder when ImageManager is first shown
HOW TO
This article shows how to select an image (or a folder) when ImageManager is first shown.
DESCRIPTION
A RadFileExplorer control is used in the ImageManager dialog and the provided solution shows how to set its InitialPath property.
SOLUTION
The desired path should be send by using a QueryString field to the ImageManager's dialog:
C#
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
// Build the URL
string initialPath = RadEditor1.DialogHandlerUrl + "?initialPath=" + this.Request.ApplicationPath + "/ROOT/SekectedImage";
RadEditor1.DialogHandlerUrl = initialPath;
}
}
RadEditor's ExternalDialogPath property should be set in order to use the customized dialog:
ASP.NET
<div class="tFormatCodeBlock <span class='RadEWrongWord' id='RadESpellError_26'>supportThreadCodeBlock</span>" style="border: 1px solid #7f9db9; overflow-y: auto;">
<telerik:RadEditor ID="RadEditor1" runat="server" Height="300px" Width="450px" ExternalDialogsPath="EditorDialogs/">
<ImageManager ViewPaths="~/ROOT" />
</telerik:RadEditor>
This approach is used in order to get reference to the RadFileExplorer control. Set the passed QueryString value to the InitialPath property of the RadFileExplorer control:
C#
protected void Page_Load(object sender, System.EventArgs args)
{
Telerik.Web.UI.RadFileExplorer RadFileExplorer1 = (Telerik.Web.UI.RadFileExplorer)this.FindRadControl(this.Page);
string initialPath = Request.QueryString["initialPath"];
if (initialPath != null)
{
if (RadFileExplorer1.InitialPath == string.Empty)
RadFileExplorer1.InitialPath = initialPath;
}
}