How to add country selection in page preview mode


I need to add country drop-down in preview mode for our multilingual website so content author can change country in preview mode and sitecore will reload page and display content  with default  language of changed country.


Please suggest if any module available.



Ravi Sharma

6 Replies

  • You have to write custom logic for this, add "Country DDL"  into core database, so it'll appear at ribbon.


    This is good starting point  Adding a custom button to the Ribbon .

  • In reply to Abhishek Malaviya:

    Thanks Abhishekh! I was planning for the same but just wanted to know if any sitecore module is available or not. I already created button in ribbon using sitecore commands.
  • In reply to Ravi Sharma:

    Hi Abhishekh! I have added button of country on following path but unable to call my custom class on button click.


    I have added button on following path and tried to bind event on following item but click is not working:


    Following key is added in commands.config as well:

     <command name="mk:alert" type="SitecorePractice.CustomAlert,SitecorePractice"/>


    Please suggest!

  • In reply to Ravi Sharma:

    Hi Ravi,

    You are almost there, it's small checkpoints that you need to check which are :
    1. Is your custom class derived from "Sitecore.Shell.Framework.Commands.Command" class?
    2. In case you are changing the commands.config outside wwwroot then is it published?
    3. If both are true then are you able to get the debugger hit the Execute method when you are clicking on the ribbon button?

    Hope these pointers help.
  • In reply to Rohan Kenkre:

    Hi Rohan,

    I checked any everything looks fine but still click is not working. I just switched working click event from one ribbon to other ribbon's click.

    I have following code in custom class as well:

    using Sitecore;
    using Sitecore.Diagnostics;
    using Sitecore.Shell.Framework.Commands;
    using Sitecore.Text;
    using Sitecore.Web.UI.Sheer;

    namespace SitecorePractice
        public class CustomAlert : Command
            public override void Execute(CommandContext context)
                //Sitecore.Context.ClientPage.ClientResponse.Alert("Testing my button");
                Assert.ArgumentNotNull((object)context, "context");
                Context.ClientPage.Start((object)this, "Run", context.Parameters);
            protected static void Run(ClientPipelineArgs args)
                Assert.ArgumentNotNull((object)args, "args");

                SheerResponse.ShowModalDialog(new UrlString("/sitecore/custom").ToString(),"450px", "300px", string.Empty, true);

  • In reply to Ravi Sharma:

    It's causing issue only inside WebEdit in core database with following path: