Custom language selector

Posted by Community Admin on 04-Aug-2018 15:37

Custom language selector

All Replies

Posted by Community Admin on 25-May-2011 00:00

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

Posted by Community Admin on 26-May-2011 00:00

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

Posted by Community Admin on 26-May-2011 00:00

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

Posted by Community Admin on 30-May-2011 00:00

Hi jocelyn ,

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

www.sitefinity.com/.../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

Posted by Community Admin on 05-Jul-2011 00:00

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

Posted by Community Admin on 05-Jul-2011 00:00

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

Posted by Community Admin on 07-Jul-2011 00:00

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

Posted by Community Admin on 07-Jul-2011 00:00

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

This thread is closed