+1-888-365-2779
Try Now
More in this section

Forums / Developing with Sitefinity / how to hide "folder up" button from page selector ?

how to hide "folder up" button from page selector ?

3 posts, 0 answered
  1. humayoo
    humayoo avatar
    89 posts
    Registered:
    25 Oct 2010
    02 Jun 2011
    Link to this post
    HI,

    reference from this post
    1. i created a custom class that inherits from UrlWebEditor. You need to override Value property and populate the control with the data you want.

    2.i replace the default UrlWebEditor with UrlWebEditorCustom inside


    Sitefinity\Admin\ControlTemplates\Pages\Dialogs\PagesSelector.ascx

    <cc:UrlWebEditor id="urlWebEditor" runat="server" /></div>

    here is my code .
    using System;
    using System.Collections.Generic;
    using System.Text;
    using Telerik.Cms.Web.UI;
    using System.Drawing.Design;
    using System.IO;
    using System.Web.UI.HtmlControls;
    using Telerik.FileManager;
    using Telerik.FileManager.WebControls;
    using System.Web;
    using System.Security.AccessControl;
    using Telerik.Web.UI;
    using System.Web.UI.WebControls;
    using System.Web.UI;
     
    /// <summary>
    /// Summary description for UrlWebEditorCustom
    /// </summary>
    namespace Telerik.FileManager.Custom
    {
        public class UrlWebEditorCustom : Telerik.FileManager.UrlWebEditor
        {
            public UrlWebEditorCustom()
            {
                //
                // TODO: Add constructor logic here
                //
            }
     
            protected override void CreateChildControls()
            {
     
                this.Controls.Clear();
                 
                DirectoryInfo a = new DirectoryInfo(HttpContext.Current.Server.MapPath("~/SlideData/"));           
                this.manageFiles = new ManageFiles();
                this.manageFiles.SetFilesGridColumnVisibility(false, false, false);
                this.manageFiles.SelectedFolderChanged += new Telerik.FileManager.FileSystemEventHandler(manageFiles_SelectedFolderChanged);
                // here get the RadGrid from files grid collection and set its page size
                FilesGrid fg = manageFiles.Controls[1] as FilesGrid;
                 
                //fg.SelectedFolderName = a.Name;
                //fg.DataBind();
                 
                // get the container
                var rd = fg.Controls[2];
                // get the radgrid
                Telerik.Web.UI.RadGrid radgridid = ((Telerik.Web.UI.RadGrid)rd.Controls[0]);
                //radgridid.PageSize = 3;           
                 
                 
                this.manageFiles.SelectedFolder = a;
                //this.manageFile s.DataBind();
                //radgridid.ItemDataBound += new Telerik.Web.UI.GridItemEventHandler(radgridid_ItemDataBound);
                //this.manageFiles.ProviderName = typeof(customprovider);
                //this.manageFiles
                 
                 
                this.Controls.Add(this.manageFiles);
     
            }
     
            void radgridid_ItemDataBound(object sender, Telerik.Web.UI.GridItemEventArgs e)
            {
                if ((e.Item.ItemType == GridItemType.Item) || (e.Item.ItemType == GridItemType.AlternatingItem) || (e.Item.ItemType == GridItemType.EditItem))
                {
                    if (e.Item is GridDataItem)
                    {
                        GridDataItem dataItem = e.Item as GridDataItem;
                        if (dataItem["Name"].Text.Equals("SlideData"))
                        {
                            dataItem.Display = true;
                        }
                        else
                        {
                            dataItem.Display = false;
                        }
                    }
                }
                e.Item.OwnerTableView.VirtualItemCount = 1;
            }
     
            void manageFiles_SelectedFolderChanged(object source, Telerik.FileManager.FileSystemEventArgs e)
            {
                base.OnValueChanged(new Telerik.Cms.Web.UI.ValueChangedEventArgs(e.Path));
            }
     
     
            public override string Value
            {
                get
                {
                    var obj = (string)ViewState["SelectedFolder"];
     
     
                    // get the selected item and add it as a value
                    // combo.SelectedItem
     
     
                    return obj;
                }
                set
                {
                    this.ViewState["SelectedFolder"] = value;
     
                }
            }
     
           
            private ManageFiles manageFiles;
     
     
        }
    }

    selected folder is this.manageFiles.SelectedFolder = "~/slidedata"; when i open page selector,it shows the correct folder slidedata and its content. but when i click "folder up" button , it move back to root folder. i do not want user to view root folder(parent folder of slide data folder). so how can i restrict not to move back on root folder ? please see the attachment
  2. humayoo
    humayoo avatar
    89 posts
    Registered:
    25 Oct 2010
    03 Jun 2011
    Link to this post
    HI,

    i am waiting for your reply. its very urgent.

    thanks
  3. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    09 Dec 2016
    07 Jun 2011
    Link to this post
    Hello humayoo,

    This is a separate control - ManageFiles. To hide the buttons you need to override it or create a custom selector instead of using UrlWebEditor. In UrlWebEditor there is a reference to ManageFiles. ManageFiles uses Telerik.FileManager.WebControls.Toobar which is initialized inside OnLoad of ManageFiles and this is the place where you can access it using a recursion, because the toolbar container is private.

    Regards,
    Ivan Dimitrov
    the Telerik team
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Register for webinar
3 posts, 0 answered