If possible, how can I set the viewpaths property for the imagemanager in the Radeditor dynamically? I need to set this based on something like a TempData variable. I tried ...
RadEditor_HTMLSource.ImageManager.ViewPaths = (String[])TempData["mykey"];
But it's not set.
Thanks
Matt
RadEditor_HTMLSource.ImageManager.ViewPaths = (String[])TempData["mykey"];
But it's not set.
Thanks
Matt
5 Answers, 1 is accepted
0
Hi Matt,
Here is the C# syntax:
You should debug your code and see why the value is not applied properly. You should also make sure that such a folder exists and that it has a sufficient permissions.
Best regards,
Rumen
the Telerik team
Here is the C# syntax:
string[] viewImages = new string[] { "~/Images" };
string[] uploadImages = new string[] { "~/Images/New" };
string[] deleteImages = new string[] { "~/Images/New/Articles", "~/Images/New/News" };
if (!IsPostBack)
{
RadEditor1.ImageManager.ViewPaths = viewImages;
RadEditor1.ImageManager.UploadPaths = uploadImages;
RadEditor1.ImageManager.DeletePaths = deleteImages;
}
string[] uploadImages = new string[] { "~/Images/New" };
string[] deleteImages = new string[] { "~/Images/New/Articles", "~/Images/New/News" };
if (!IsPostBack)
{
RadEditor1.ImageManager.ViewPaths = viewImages;
RadEditor1.ImageManager.UploadPaths = uploadImages;
RadEditor1.ImageManager.DeletePaths = deleteImages;
}
You should debug your code and see why the value is not applied properly. You should also make sure that such a folder exists and that it has a sufficient permissions.
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.
0

Matt
Top achievements
Rank 1
answered on 28 Dec 2010, 11:29 AM
Thanks but still not working. I can see the value being set for viewpaths but when I open the image manager the files are still not visible. I've confirmed that it works when I set the viewpaths in the mark up. The permissions are set correctly (Network Service has full control).
If I keep the code that sets the viewpaths and then set the viewpaths attribute in the markup the value from the markup is used. So, it looks that anything I do in code is ignored.
I'm in a partial view but I tried it in a normal MVC page with the same problem.
If I keep the code that sets the viewpaths and then set the viewpaths attribute in the markup the value from the markup is used. So, it looks that anything I do in code is ignored.
I'm in a partial view but I tried it in a normal MVC page with the same problem.
<
div
>
<%
RadEditor_HTMLSource.Content = (ViewData.Model.Mailing != null) ? ViewData.Model.Mailing.HTMLSource : "";
i
f (!IsPostBack) {
RadEditor_HTMLSource.ImageManager.ViewPaths = (String[])TempData["SchoolId"];
RadEditor_HTMLSource.ImageManager.UploadPaths = (String[])TempData["SchoolId"];
RadEditor_HTMLSource.ImageManager.DeletePaths = (String[])TempData["SchoolId"];
}
%>
<
telerik:RadStyleSheetManager
ID
=
"RadStyleSheetManager1"
runat
=
"server"
>
</
telerik:RadStyleSheetManager
>
<
telerik:RadEditor
ID
=
"RadEditor_HTMLSource"
ExternalDialogsPath
=
"~/Content/Controls/EditorDialogs/"
runat
=
"server"
ContentFilters
=
"MakeUrlsAbsolute"
DialogHandlerUrl
=
"~/Telerik.Web.UI.DialogHandler.axd"
ToolsFile
=
"~/Content/MailingTools.xml"
Skin
=
"Black"
>
<
FlashManager
MaxUploadFileSize
=
"5242880"
ViewPaths
=
"~/Public"
UploadPaths
=
"~/Public"
/>
<
MediaManager
MaxUploadFileSize
=
"5242880"
ViewPaths
=
"~/Public"
UploadPaths
=
"~/Public"
/>
<
DocumentManager
MaxUploadFileSize
=
"5242880"
ViewPaths
=
"~/Public"
UploadPaths
=
"~/Public"
/>
</
telerik:RadEditor
>
</
div
>
0

Matt
Top achievements
Rank 1
answered on 29 Dec 2010, 03:42 PM
I've updated to the latest version of ASP.net ajax but still an issue. Any others ideas on what to try?
I tried to use an example project - 173294_mvcwithradeditor.zip - provided by Telerik on another post. This also doesn't work.
I tried to use an example project - 173294_mvcwithradeditor.zip - provided by Telerik on another post. This also doesn't work.
0
Accepted
Hi Matt,
The <% %> server tags are executed when the page is rendered on the page, but the FileBrowser dialogs of RadEditor expect to be configured before the Page_Load event. Here is how to set the paths:
Kind regards,
Rumen
the Telerik team
The <% %> server tags are executed when the page is rendered on the page, but the FileBrowser dialogs of RadEditor expect to be configured before the Page_Load event. Here is how to set the paths:
<script runat=
"server"
type=
"text/C#"
>
protected
void
Page_Load(
object
sender, EventArgs e)
{
RadEditor_HTMLSource.Content =
"test"
;
if
(!IsPostBack)
{
RadEditor_HTMLSource.ImageManager.ViewPaths =
new
string
[] {
"~/"
}; ;
RadEditor_HTMLSource.ImageManager.UploadPaths =
new
string
[] {
"~/"
};
RadEditor_HTMLSource.ImageManager.DeletePaths =
new
string
[] {
"~/"
};
}
}
</script>
<telerik:radstylesheetmanager id=
"RadStyleSheetManager1"
runat=
"server"
>
</telerik:radstylesheetmanager>
<telerik:radeditor id=
"RadEditor_HTMLSource"
runat=
"server"
contentfilters=
"MakeUrlsAbsolute"
skin=
"Black"
DialogHandlerUrl=
"~/Telerik.Web.UI.DialogHandler.axd"
>
</telerik:radeditor>
Kind 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.
0

Matt
Top achievements
Rank 1
answered on 30 Dec 2010, 06:24 PM
Thanks, that solved it.