How to remove Create New button

May 6, 2013 at 7:35 AM
I need to remove the create new button from the view. Is that possible? If so please tell me how to do it.
Coordinator
May 12, 2013 at 8:37 AM
Hi Eraja,

Okay, so in v.2.0. this will be trivial, but unfortunately this version is not released yet, so that's a bit of a bummer.

In v1.x. what you can do is create your own View-type that disables the buttons:
using System.Linq;
using System.Web;
using System.Xml.Linq;
using Eksponent.Dewd.Repositories;
using Eksponent.Dewd.Extensions;
using System.Data;
using umbraco.DataLayer;
using umbraco;
using Eksponent.Dewd.Controls.View;
using Eksponent.Dewd.Views;
using Eksponent.Dewd.Fields.ValueGetters;

namespace MyNameSpace
{
    public class EditOnlyTableView : DataTableBasedView
    {
        public EditOnlyTableView(XElement viewElement, IRepository repository) : base(viewElement, repository)
        {
        }

        __public override bool AddMenuButtons()__
        {
            return false;
        }
    }
}
Put that in App_Code for example and point to the new view by using the type-attribute on the view-element:
<view name="Todays entries" type="MyNameSpace.EditOnlyTableView,App_Code">

Disclaimer: I totally didn't test this, but the principal is sound :)

Hope that helps.
  • Sune
May 13, 2013 at 7:46 AM
Hi suneboeegh

Thanks for the reply. I figured it out using the code anyway thanks again. :)