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

Localization for MozillaPasteHtmlDialog content

5 Answers 51 Views
Editor
This is a migrated thread and some comments may be shown as answers.
Kyle Finley
Top achievements
Rank 1
Kyle Finley asked on 29 Feb 2012, 07:46 PM
I need to be able to set the localization elements for the 'Past from Word' dialog in the RadEditor.  I've tried customizing the dialog and adding a code behind to retrieve the localization values but I get a runtime error saying the code behind class type can not be found.  I've also tried accessing our localization framework directly in the MozillaPasteHtmlDialog.ascx file but it appears that no script block code will actually run.  I'm assuming this has something to do with how the Telerik.Web.UI.DialogHandler.aspx handler works.
 
I assume there is a way to set these values (specifically UseControlVMessage, Paste, and Cancel) from code while setting up the RadEditor as you would the MainStrings and ToolsStrings but I can not find a way to do that after much searching through the documentation and online.

I'm using version 2009.2.701.35 and can not upgrade to a newer version so I need a solution that works in that version.  Any assistance would be greatly appreciated.

5 Answers, 1 is accepted

Sort by
0
Kyle Finley
Top achievements
Rank 1
answered on 01 Mar 2012, 04:45 PM
I'm still looking for an answer to this but I do have a little bit of an update for anyone else that runs into this.

Telerik provides the option to customize the dialog controls that are used for the various commands by setting the ExternalDialogsPath property on the RadEditor.  You can extract the ascx files used for the dialogs from the Telerik.Web.UI assembly (or download them from various support posts) but these controls can not contain any .net code.  When these dialog controls are loaded they are rendered using the ParseControl method.  This method only renders HTML and does not do any compilation. Here is the MSDN documentation, http://msdn.microsoft.com/en-us/library/kz3ffe28.aspx, which states the following:

"The content parameter contains a user control, such as you would find in an .ascx file. This string cannot contain any code, because the ParseControl method never causes compilation."

Personally I think this is very poor design on the part of Telerik and causes confusion to those of us out there trying to use the product.  Why would you use a .ascx file for something that can only be HTML?  It causes us to make the assumption that if the files are .ascx files then we can use .NET code inside them.  This is unfortunately not the case.  And unfortunately this stuff doesn't seem to be documented ANYWHERE.

As it stands I'm still looking for a way to programmatically set the localization strings for a command dialog for the RadEditor.  I suspect it simply can't be done.  Which is unfortunately for a control that claims to be such a full feature control.
0
Rumen
Telerik team
answered on 02 Mar 2012, 10:27 AM
Hi,

The ParseControl method is used so that the RadEditor's dialogs can be embedded in the Telerik.Web.UI.dll and loaded from it. If you want to run some code in the codebehind, the solution is to create a custom control and to add it to the ascx dialog file. After that you will be able to work with the codebehind of your custom control as shown in the following KB article: Displaying single upload control in the FileBrowser Upload manager.

You can also update the localization strings of the MozillaPasteHtmlDialog dialog through the provided RadEditor.Dialogs.resx localization file. More information is available in the following article: Using Global Resource Files.

Best regards,
Rumen
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
0
Kyle Finley
Top achievements
Rank 1
answered on 02 Mar 2012, 10:24 PM
Rumen,

Can you explain how embedding a user control in the existing MozillaPasteHtmlDialog.ascx control will allow me to access the localization array that is in JavaScript?  Also updating the .resx files is not an option because the translations are stored in a database and need to be set at runtime.

At this point your answer provides me with some possible things I can continue to spend time on but I do not see a clear answer here.

I need to be able to set the localization strings that the popup uses in JavaScript from my C# code.  Please let me know how your answer helps me do this.

Kyle
0
Rumen
Telerik team
answered on 05 Mar 2012, 10:39 AM
Hello,

In my earlier reply I just explained why the ParseControl method is used and provided an example how a server code can be executed in the dialogs.

RadEditor does not offer the requested feature to localize its dialogs through the server because the dialogs are not part of the editor control and they are separate ascx files, which are not placed on the same page with the editor. The implementation of the required feature is hard and requires to output extra localizations strings / markup on the page which will slow down the page loading.

For the time being, the only possible way to localize the editor's dialogs is to use the provided resx files. If you want you can dynamically create and edit the RadEditor.Dialogs.resx file, which is an XML file.

All the best,
Rumen
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
0
Kyle Finley
Top achievements
Rank 1
answered on 06 Mar 2012, 09:56 PM
I was able to get this to work by creating a user control that has the content of the mozillaPageHtmlDialog file and placing that on the (now empty) existing MozillaPasteHtmlDialog.ascx user control that the popup uses.  This allowed me to use the code behind and retrieve the localized strings from the Database.

Pretty lame but it works.
Tags
Editor
Asked by
Kyle Finley
Top achievements
Rank 1
Answers by
Kyle Finley
Top achievements
Rank 1
Rumen
Telerik team
Share this question
or