Skip to content
June 21, 2014 / kiranpatils

Sticky Database Name in Sitecore CE

Challenge:

While accessing a Sitecore Items from Sitecore Content Editor at times It happened with me and my friends that they moved to Web Database they did some change in Web database considering that they are in Master database — What, It happened with you as well?! (See, we all live in the same world!)

This is something I faced so long back, and tried to find some solution and found one as well. Thought to share with you. But got caught with lot of things. So couldn’t do it. But last week or so — noticed this question and thought this is the good time to get it penned down.

Solution:

Nick Hills already blogged on this here — http://blog.boro2g.co.uk/ever-edited-sitecore-web-db-mistake/ and I liked his solution! But thought to share my solution as well. So, you guys get a lot of options. And it’s good to have more than one ways to do one thing!

First of all,  Did you know this option? “Show Database Name” – It is really helpful!

show-databse-name

But, It has one strange behavior. When you select it, it will show you Database Name. But as soon as you open Sitecore CE. It will stop showing current database name. And as per my understanding this is the time when you really need it! — What say?

So, I thought to find out how it is getting displayed and can we make it sticky? And you will be happy to know — we can do it! And that too via just a simple CSS change! Before I share the steps, let me show you. How it looks like:

 

ce-master-white

 

Looks good?! Eager to know the steps? Here we go:

  1. Basically this text is coming from DIV and it has CSS applied which comes from : <WEBSITEROOT>\sitecore\shell\Themes\Standard\Default
  2. Shell.css file
  3. Locate this CSS file in your solution and apply a following CSS definition for the class .scDatabaseName with following CSS [As you can see, two properties has been changed color and z-index! Out of this  Z-Index does the main  trick!]:
.scDatabaseName
{
    cursor: default;
    position: absolute;
    margin: -44px 0px 0px -8px;
    color: White;  /*Updated for displaying database name always*/
    font: 14pt tahoma;
    z-index: 1000;  /*Updated for displaying database name always*/
}

That’s it! Open your Browser (Just a note : You might need to clear browser cache or do hard refresh), Login to Sitecore and see your current DB always in front of your eyes!
In case, if you would like to see it with Yellow background as a Highlighted text, as shown below:

master-yellow You can do it via applying following style:

.scDatabaseName
{
    cursor: default;
    position: absolute;
    margin: -44px 0px 0px -8px;
    color: black;  /*Updated for displaying database name always*/
    font: 14pt tahoma;
    z-index: 1000;  /*Updated for displaying database name always*/
    background-color:Yellow; /*Updated for displaying database name always*/
}

And yes, If you are asking me which trick I should use? Nicks or the one which you read in this blog. I would suggest why don’t you apply both?! 🙂 Like the way I did in my local box:

 

2014-06-21 19_10_36-Shell.css - Microsoft Visual StudioYou might find this as a small trick. But it can save you from BIG challenges! [Quotable Quote : Little Drops of Water Make the Mighty Ocean]

Happy Sitecoring! 🙂

Advertisements

3 Comments

Leave a Comment
  1. vsrathore2 / Jun 24 2014 4:58 pm

    Here ‘s another blog about doing this:
    http://adeneys.wordpress.com/2010/08/25/display-database-name-in-sitecore-desktop-always/

    • kiranpatils / Jul 19 2014 10:08 pm

      Great — Thanks Vikram for sharing!

  2. visitkingscliff.com / Dec 11 2015 4:11 pm

    What’s up to every one, the contents present at this
    web page are in fact awesome for people experience, well,
    keep up the good work fellows.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: