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

Forums / Developing with Sitefinity / Custom language selector

Custom language selector

8 posts, 0 answered
  1. jocelyn payneau
    jocelyn payneau avatar
    51 posts
    Registered:
    07 Dec 2009
    25 May 2011
    Link to this post
    Hello,

    For the website i am developping, the language selector has custom html layout.

    I create a project with a CustomLanguageSelector class inherited from LanguageSelectorControl.
    This creates a custom web control.

    I create the layout in an ascx file which is in my SitefinityWebApp project under UserControls/Navigation.

    I have placed the language selector on a page template based on a master page.

    How can I tell to Sitefinity to use my layout instead of default one?

    I am using SF4.1.
    The code is similar to the one given by Ivan Dimitrov in this thread http://www.sitefinity.com/devnet/forums/sitefinity-4-x/general-discussions/language-selector-error.aspx

    Could you please help me?

    Thanks
    Jocelyn
  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    16 Jun 2017
    26 May 2011
    Link to this post
    Hello jocelyn,

    The control has a template LanguageSelectorControl.ascx where you should define the layout of the control. The default template was posted in the forum thread, so you can see the css classes that are used an modify them accordingly.

    Best wishes,
    Ivan Dimitrov
    the Telerik team
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  3. jocelyn payneau
    jocelyn payneau avatar
    51 posts
    Registered:
    07 Dec 2009
    26 May 2011
    Link to this post
    Hello Ivan,

    Thanks for your reply.

    I have understood this but what should be the virtual path to type in the language selector widget property?

    Regards
  4. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    16 Jun 2017
    30 May 2011
    Link to this post
    Hi jocelyn ,

    You should use the Virtual Path Provider to set the template. Please take a look at this post

    http://www.sitefinity.com/blogs/slavoingilizov/posts/11-04-18/taking_advantage_of_the_virtual_path_provider_in_sitefinity_4_1.aspx

    Basically the steps are

    1. Define a prefix for your VPP
    2. Register the VPP though the configurations where you set the assembly where your templates are added as embedded resources.

    All the best,
    Ivan Dimitrov
    the Telerik team
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  5. jocelyn payneau
    jocelyn payneau avatar
    51 posts
    Registered:
    07 Dec 2009
    05 Jul 2011
    Link to this post
    Hello,

    I am not very familiar yet with virtual paths.

    Can you give me a sample adapted to my case please?

    In which file should I register the virtual path?

    Thanks
    Jocelyn
  6. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    16 Jun 2017
    05 Jul 2011
    Link to this post
    Hello Jocelyn ,

    You have to override LayoutTemplatePath and LayoutTemplateName

    ublic override string LayoutTemplatePath
            {
                get
                {
                    return layoutTemplatePath;
                }
                
            }

            protected override string LayoutTemplateName
            {
                get
                {
                    return null;
                }
            }

    Then you need to set VPP prefix in the private constraint layoutTemplatePath

    private const string layoutTemplatePath = "~/SfSamples/Telerik.Sitefinity.Samples1.Resources.SimpleViewCustomTemplate.ascx";

    From Sitefinity>> Administration >> Settings >> Advanced >> VirtualPathSettings you should register the tag prefix

    Best wishes,
    Ivan Dimitrov
    the Telerik team
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  7. jocelyn payneau
    jocelyn payneau avatar
    51 posts
    Registered:
    07 Dec 2009
    07 Jul 2011
    Link to this post
    Hello,

    I have registered it like this

    ~/SFSamples/SitefinityWebApp.UserControls.Navigation.CustomLanguageSelector.ascx


    But I still have the error

    Cannot find template "~/SFSamples/SitefinityWebApp.UserControls.Navigation.CustomLanguageSelector.ascx".



    Thanks
    Jocelyn
  8. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    16 Jun 2017
    07 Jul 2011
    Link to this post
    Hi ,

    Have you built the template as an embedded resource? You can check our SDK to see the actual implementation of a control with a template and control with control designer.

    Regards,
    Ivan Dimitrov
    the Telerik team
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
8 posts, 0 answered