1-888-365-2779
+1-888-365-2779
Try Now
More in this section

Forums / Developing with Sitefinity / PageSelector Multilanguage

PageSelector Multilanguage

3 posts, 0 answered
  1. Nathalia
    Nathalia avatar
    25 posts
    Registered:
    16 Nov 2011
    05 Feb 2013
    Link to this post
    Hello,

    I'm using Sitefinity 5.1 and have problems with a Page selector control. The website is multilingual. Now I seem that the page selector always shows the page tree of the default language. If the default language is english, the english page tree will be displayed.
    I need to display the page tree language depending on the language of the page I'm editing. If I edit spanish page, the page tree will be displayed in spanish. How I can do that?

    Here's my code:
    Designer.ascx

    div class="rwWindowContent rwExternalContent">
        <div class="sfDialog sfSelectorDialog sfDesignerSimpleMode">
          <ul>
                <li>
                    <sf:PageField ID="PageSelector" runat="server"        WebServiceUrl="~/Sitefinity/Services/Pages/PagesService.svc/" DisplayMode="Write" />           
                </li>
         </ul>
       </div>
    </div>

    Designer.cs

    public class DesignerMapping : ContentViewDesignerView
    {
     public override IEnumerable<System.Web.UI.ScriptDescriptor> GetScriptDescriptors()
            {
               var descriptor = new ScriptControlDescriptor(this.GetType().FullName, this.ClientID);
               descriptor.AddComponentProperty("PageSelectorControl",this.Container.GetControl<Telerik.Sitefinity.Web.UI.Fields.PageField>     ("PageSelector", true).ClientID);
                return new[] { descriptor };
            }
     
     protected override void InitializeControls(Telerik.Sitefinity.Web.UI.GenericContainer container)
            {
                this.Container.GetControl<Telerik.Sitefinity.Web.UI.Fields.PageField>("PageSelector", true).RootNodeID = Telerik.Sitefinity.Abstractions.SiteInitializer.FrontendRootNodeId;
             }
    }

    Designer.js

    DesignerMapping = function (element) {
        DesignerMapping.initializeBase(this, [element]);
        this._pageSelectorControl = null;
    }
    DesignerMapping.prototype = {
        initialize: function () {
            DesignerMapping.callBaseMethod(this, 'initialize');
        },
        dispose: function () {
            DesignerMapping.callBaseMethod(this, 'dispose');
        },
        refreshUI: function () {
            var pageid = this.get_controlData().PageID;
            if (pageid ) {
                this.get_pageSelectorControl().set_value(pageid);
            }
        },
        applyChanges: function () {
            this.get_controlData().LoginPageID = this.get_pageSelectorControl().get_value();
        },
        get_controlData: function () {
            return this.get_parentDesigner().get_propertyEditor().get_control(); 
        },
        get_parentDesigner: function () {
            return this._parentDesigner;
        },
        set_parentDesigner: function (value) {
            this._parentDesigner = value;
        },
        get_pageSelectorControl: function () {
            return this.pageSelectorControl;
        },
        set_pageSelectorControl: function (value) {
            this._pageSelectorControl = value;
        }
    }

    Thanks,
    Nathalia.



  2. Daniel Plomp
    Daniel Plomp avatar
    952 posts
    Registered:
    18 Feb 2004
    05 Feb 2013 in reply to Nathalia
    Link to this post
    Hi Nathalia,

    You could try to add this code to your Initialize method:
    if (this.PropertyEditor != null)
    {
       var uiCulture = this.PropertyEditor.PropertyValuesCulture;
       this.PageSelectorControl.UICulture = uiCulture;
    }

    Regards,
    Daniel
  3. Nathalia
    Nathalia avatar
    25 posts
    Registered:
    16 Nov 2011
    05 Feb 2013 in reply to Daniel Plomp
    Link to this post
    Hi Daniel,
      Thanks for you reply. I used to ContentViewDesignerView so in this class doesn't have the this.PropertyEditor property and my control PageField doesn't contain a definition for 'UICulture', I don't know if exist a instance for that object.

    this.Container.GetControl<Telerik.Sitefinity.Web.UI.Fields.PageField>("PageSelector", true).UICulture = uiCulture;

    Thanks,
    Nathalia.
3 posts, 0 answered