Localization for MozillaPasteHtmlDialog content

6 posts, 0 answers
  1. Kyle Finley
    Kyle Finley avatar
    4 posts
    Member since:
    Aug 2004

    Posted 29 Feb 2012 Link to this post

    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.
  2. Kyle Finley
    Kyle Finley avatar
    4 posts
    Member since:
    Aug 2004

    Posted 01 Mar 2012 Link to this post

    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.
  3. Rumen
    Admin
    Rumen avatar
    14351 posts

    Posted 02 Mar 2012 Link to this post

    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.
  4. Kyle Finley
    Kyle Finley avatar
    4 posts
    Member since:
    Aug 2004

    Posted 02 Mar 2012 Link to this post

    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
  5. Rumen
    Admin
    Rumen avatar
    14351 posts

    Posted 05 Mar 2012 Link to this post

    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.
  6. Kyle Finley
    Kyle Finley avatar
    4 posts
    Member since:
    Aug 2004

    Posted 06 Mar 2012 Link to this post

    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.
Back to Top