Custom language selector
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
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
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
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
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
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
Hello,
I have registered it like this
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