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

Forums / Developing with Sitefinity / How To Use Panel Bar to Just Display one Page And Its Childs...

How To Use Panel Bar to Just Display one Page And Its Childs...

6 posts, 0 answered
  1. Adeel Arif
    Adeel Arif avatar
    27 posts
    Registered:
    30 Dec 2009
    18 Jan 2010
    Link to this post
    Hi All,

    I am struck in an interesting problem that is i want to use radpanelbar to display a page that is given to it and it should just only display its child pages only not the other neighbouring pages........

    e.g
           Home
            
    AnyChild1
            AnyChild2
            AnyChild3
    but the other pages in the same heirarchy should not be displayed....

    thankyou
    your help will be really appreciated.

    regards Adeel Arif.
               
  2. Radoslav Georgiev
    Radoslav Georgiev avatar
    3370 posts
    Registered:
    01 Feb 2016
    18 Jan 2010
    Link to this post
    Hello Adeel Arif,

    Thank you for using our services.

    Could you please try with the following settings on the Site Panelbar control (refer to attached image).

    All the best,
    Radoslav Georgiev
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  3. Adeel Arif
    Adeel Arif avatar
    27 posts
    Registered:
    30 Dec 2009
    19 Jan 2010
    Link to this post
    Thank you Radoslav Georgiev but it looks like it didnt help much, i have got to a solution which is fine but still not very optimal. Can you kindly take a look at below given code and tell me....

    public partial class UserControls_Website_Navigation_Link2 : System.Web.UI.UserControl
    {
        ArrayList mypages = new ArrayList();
        public struct MainPages
        {
            public string Name
            {
                get;
                set;
            }
            public string Url
            {
                get;
                set;
            }
        }
        public string PageToFetch
        {
            get;
            set;
        }
        public MainPages heading;
        protected void Page_Load(object sender, EventArgs e)
        {
            MainPages pags;
            CmsManager manager = new CmsManager();
            Guid pageid=new Guid();
            IList pages = manager.GetPages();
            foreach (IPage p in pages)
            {
                if (p.Name == PageToFetch)
                {
                    heading = new MainPages();
                    ICmsPage tp = manager.Provider.GetCmsPage(p.ID);
                    heading.Name = tp.MenuName;
                    ICmsPage urlpage = p.CmsProvider.GetCmsPage(p.ID);
                    heading.Url = urlpage.DefaultUrl.Url;
                    pageid=p.ID;
                    break;
                }
            }
            IList childs = manager.GetPages(pageid);
            foreach (IPage childpage in childs)
            {
                pags = new MainPages();
                ICmsPage tp = manager.Provider.GetCmsPage(childpage.ID);
                pags.Name = tp.MenuName;
                ICmsPage p = childpage.CmsProvider.GetCmsPage(childpage.ID);
                pags.Url = p.DefaultUrl.Url;
                mypages.Add(pags);

            }
            DataList1.DataSource = mypages;
            DataList1.DataBind();
        }
    }

    That i have to first get all the pages in order to get a specific page e.g "p.Name=Products".this is not very efficent as i also have to itrate through the pages and find my required page. is there any wou to get the specific page's GUID by specifying its name????

    Thankyou....
    Regards Adeel Arif
  4. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    12 Sep 2017
    19 Jan 2010
    Link to this post
    Hi Adeel Arif,

    You can use WebEditor to select the page from where you want to bind the menu instead of poulating an IList

    [WebEditor("Telerik.Cms.Web.UI.UrlEditorWrapper, Telerik.Cms")]
    [Browsable(true)]
    [Category("Navigation")]
    public string StartingNodeUrl
    {
        get
        {
            return this.SiteMapDataSource1.StartingNodeUrl;
        }
        set
        {
            this.SiteMapDataSource1.StartingNodeUrl = value;
        }
    }

    This will automatically bind the RadPanelBar from the selected node. The ArrayList in your code is not used.


    Best wishes,
    Ivan Dimitrov
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  5. Adeel Arif
    Adeel Arif avatar
    27 posts
    Registered:
    30 Dec 2009
    19 Jan 2010
    Link to this post
    Thanks Ivan finally i got the hang of it...
            Previously i asked you about the news filtering by date and it went fine but now i am trying to get the news by category and the filter expression doesnt seem to work can you guide me a little on it , it would be very nice of you....

    Code=>

    NewsManager

     

    manager = new NewsManager("News");

     

    manager.Content.FilterExpression =

    "Category=\"public\"";

     

     

    IList Titles = manager.Content.GetContent(1, items);

    the result is empty as no news of the public category gets displayed...

    i also used "Category IN (\"public\")"
    but i get the error Invalid Expression.....

    thanks again for helping me on the RadPanel.

    Regards
    Adeel Arif

     

  6. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    12 Sep 2017
    19 Jan 2010
    Link to this post
    Hello Adeel Arif,

    Use ContentFilterBuilder class

    ContentFilterBuilder filter = new ContentFilterBuilder(control);
    filter.ClearFilter();
    filter.AddFilter(new ContentFilterStatement("Category", "nameofthecategory", ContentFilter.Condition.Equal));

    or MetaSearchInfo filter.

    var newsManager= NewsManager();
    List<Telerik.Cms.Engine.IMetaSearchInfo> filter = new List<Telerik.Cms.Engine.IMetaSearchInfo>();
    filter.Add(new Telerik.Cms.Engine.MetaSearchInfo(Telerik.Cms.Engine.MetaValueTypes.ShortText, "Category", "NameofCategory"));
    IList listOfContentItems = newsManager.GetContent(filter.ToArray());
    if (listOfContentItems.Count > 0)
    {
       foreach (Telerik.Cms.Engine.IContent contentItem in listOfContentItems)
           Response.Write("<br />" + contentItem.GetMetaData("Name") + "<br />");
    }


    Best wishes,
    Ivan Dimitrov
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Register for webinar
6 posts, 0 answered