I am using Sitecore 8.2 (initial release) and I have a case when for a rendering I have defined the fields

'Datasource Template'


'Datasource Location'

but I need to disable the button for

'Create new content'

that appears in the window displayed in editor when adding a component.

enter image description here

I can see that if no 'Datasource Template' is defined on the rendering the button is disabled by default, so this seems doable.

enter image description here

Is there an easy way to somehow disable it even if I have defined the template for the rendering?

3 Answers 3


You need to change: \Website\sitecore\shell\Applications\Dialogs\SelectRenderingDatasource\SelectRenderingDatasource.xml

He use Sitecore.Shell.Applications.Dialogs.SelectRenderingDatasource class.

You need to override method

 protected override void OnLoad(EventArgs e)

You need to have something like

 if (yourconditionaretrue)
  • A good starting point for what I needed. Thanks!
    – Adrian C.
    Jan 19, 2017 at 9:38

You can remove Create access right from certain group of users. This won't disable the button but nobody from this group will be able to create anything there.

Sitecore will display a message and disable the OK button as on the picture below.

Message which will be shown to the users

  • I want to totally disable the button for everyone by a specific checkbox field I added on rendering template, if that is checked then the button should be disabled, else fallback to default. I have some specific renderings that when added as components editors shouldn't be able to create new content in tree, just select some existing one.
    – Adrian C.
    Jan 19, 2017 at 9:38
  • You have asked for an easy way :) This is not exactly what you wanted but it's quick and out of the box assuming all your data items are in a single directory. Jan 19, 2017 at 10:12

To answer my own question here is the right solution (after doing some investigations on what Sitecore Climber wrote):

  1. Create new class that inherits the


from dll


this is the namespace found on tag CodeBeside in


probably depending on your sitecore version you can have different namespace there so inherit whatever you have there set.

  1. Override the OnLoad method with:

protected override void OnLoad(EventArgs e) {


if (NeedToDisable)


Now since DisableCreateOption is private we need to copy it to our code to be able to call it.

private void DisableCreateOption(){

this.CreateOption.Disabled = true;

this.CreateOption.Class = "option-disabled";

this.CreateOption.Click ="javascript:void(0);";

this.CreateIcon.Src = Images.GetThemedImageSource(this.CreateIcon.Src, ImageDimension.id32x32, true);


  1. Do some logic in the NeedToDisable property that will return if the 'Create new content' buttons needs or not to be disabled.

public bool NeedToDisable{

return true; //replace this with your logic


  1. Build and make sure your new changes are in the dll in website bin.

  2. Go to \Website\sitecore\shell\Applications\Dialogs\SelectRenderingDatasource\ directory and open SelectRenderingDatasource.xml

  3. Change the CodeBeside tag from old type 'Sitecore.Buckets.Forms.SelectRenderingDatasourceForm, Sitecore.Buckets' to your new created class in the dll.

  4. Enjoy the new functionality.

Everything works great and as expected, except point 3, now I want to make the NeedToDisable property dynamic depending on an extra checkbox field I set on the rendering template and I will check or not.

My problem now is if there is a way to get a reference to the rendering fields when I am on this dialog. I think that maybe I need to override the previous dialog where you select the rendering type the new component will be but not sure where can I find this.

enter image description here

Any ideas?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.