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

[Solved] Adding r.a.d Editor to another web part programatically

3 Answers 59 Views
RadEditor
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
HarishNIH
Top achievements
Rank 1
HarishNIH asked on 28 Feb 2007, 03:44 PM
Hello,  I installed r.a.d Editor for Sharepoint and it works fine on the sharepoint pages when I try to insert as a web part in a web part zone.  When I try to use the same web part (RadEditor.dll) in another custom web part to generate the r.a.d. Editor programatically, I am getting security execption when it comes to create the object of RadEditor.  Here is the sample snipped of code.

t = New Table
r =
New TableRow
c =
New TableCell

radEdit = New Telerik.WebControls.RadEditor

radEdit.ConfigFile = "~/wpresources/RadWebParts/RadControls/Editor/ConfigFile.xml"

radEdit.ID = "testeditor1"
c.Controls.Add(radEdit)
r.Cells.Add(c)
t.Rows.Add(r)
Controls.Add(t)

Error that I am getting is:

 
The type initializer for "Telerik.RadEditorUtils.RadControl" threw an exception.
RadEditor
at Telerik.RadEditorUtils.RadControl.get_Version() at Telerik.RadEditorUtils.RadControl.get_ScriptsUrl() at Telerik.RadEditorUtils.RadControl.CheckIfScriptsFolderExists() at Telerik.RadEditorUtils.RadControl.CheckWorkingConditions(WorkingConditionFlags workingConditionFlags, String& errorMessage) at Telerik.RadEditorUtils.RadControl.CheckWorkingConditions(String& errorMessage) at Telerik.WebControls.RadEditor.Render(HtmlTextWriter output) at System.Web.UI.Control.RenderControl(HtmlTextWriter writer) at CSRStudySessionWebParts.EditPost.RenderWebPart(HtmlTextWriter output) in D:\CSRAED\CSRStudySessionWebParts\EditPost.vb:line 269



Additional related information: I haved installed the r.a.d Editor for sharepoint into GAC, and local bin folder (c:\inetpub\wwwroot\bin to and added this radEditor.dll and radSpell.dll to the web part project as references so that I can call these objects in the web part code)

Thanks,
Harish V.

3 Answers, 1 is accepted

Sort by
0
Lini
Telerik team
answered on 01 Mar 2007, 07:14 AM
Hello Harish,

Try raising the trust level of the SharePoint application to Full and see if the error disappears. The latest version of the editor should be able to work fine in Medium trust too, but I recommend first trying the Full trust setting. Do not forget to reset IIS after you modify the Web.config.

Regards,
Lini
the telerik team
0
HarishNIH
Top achievements
Rank 1
answered on 01 Mar 2007, 02:37 PM
Thanks for your reply Lini.  Can you please make sure the way I am trying to use r.a.d Editor of sharepoint version can be rendered the way I am trying to do.  You can see the sample code in my initial posting on this post.  Since I am trying to use this on a ListItem page, not on the main webparts page,  I will not have the properties panel of a webpart.  In this case, how can I go to design mode of the editor and enter the content.  Do I need to add any aditional components to the custom web part.  Any sample code for rendering the r.a.d editor of sharepoint would be much helpful. 
I have tried the full trust and still didn't work.

Thanks in advance,
Harish V.
0
Lini
Telerik team
answered on 02 Mar 2007, 09:38 AM
Hello Harish,

I am attaching a simple web part project, which I used to test your code in SharePoint 2003. The web part worked fine on our test server. I put the editor and spell assemblies in the GAC. You will also find the site's web.config file in the archive - compare it to yours and see if you missed something (SafeControl, trust level, etc.).

You will only need to change the paths to RadControls folder. I used /wpresources/RadWebParts/RadControls/ since this is the default path to the RadControls folder when you install our SharePoint 2003 editor.

Sincerely yours,
Lini
the telerik team
Tags
RadEditor
Asked by
HarishNIH
Top achievements
Rank 1
Answers by
Lini
Telerik team
HarishNIH
Top achievements
Rank 1
Share this question
or