More in this section

Forums / Developing with Sitefinity / How to show content dynamically

How to show content dynamically

4 posts, 0 answered
  1. Priti
    Priti avatar
    17 posts
    Registered:
    20 Nov 2008
    28 Nov 2008
    Link to this post
    Hi,

    I very new to Sitefinity and exploring it currently. In my website I want to create pages using single template. There are two placeholders in my template.
    1. left navigation
    2. Main content area

    Left navigation shows Site panel bar for pages in current section
    (same as http://www.sitefinity.com/ shows if I click on Support or any other link from top navigation menu.)

    On click of any link from left navigation I want to show differrent generic content item in Main content area.

    I don't want to do any thing at desing time. or anything that I need to do on every page. Everything should be done dynamically at runtime. So that even if I want to add new pages I just need to create the page, assign the template and add appropriate Generic content item. No need to actually edit the page.

    Can I do this with Sitefinity? I know it would be. Please let me know how to implement this or at least point me to the sample where such thing is implemented.

    Thanks in advance.

    Priti.
  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    12 Sep 2017
    28 Nov 2008
    Link to this post
    Hello Priti,

    Thank you for using our services.

    Here is an example.

    For instance you could bind the PanelBar control and use :

    Guid contentID = //get the Guid of the content you want to open with this link 
    string itemLink = CmsUrlContext.Current.Path + "?ContentID=" + contentID; 
    panelbarItem.NavigateUrl = itemLink; 

    Then get the content based on a QueryString parameter as the example below demonstrates.

    protected void Page_Load(object sender, EventArgs e) 
        { 
            if (!String.IsNullOrEmpty(Request.QueryString["contentID"])) 
            { 
                // get the content based on a QueryString parameter contentID 
                Guid contentID = new Guid(Request.QueryString["contentID"]); 
                ContentManager manager = new ContentManager(); 
     
                IContent content = manager.GetContent(contentID); 
     
                // Render content from content.Content 
            } 
        } 


    I hope this helps.

    Greetings,
    Ivan Dimitrov
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
  3. Priti
    Priti avatar
    17 posts
    Registered:
    20 Nov 2008
    01 Dec 2008
    Link to this post
    Hi Ivan,

    Thanks for the answer.

    OK so I can do it using Querystring. But I have one more doubt here.
    In which page I will be adding this Page_Load event handler?

    I have a page group say About Us. Inside it I have Mission Statement, History, Contact Us, etc.
    Can I create a single page with Content ID as querystring and put Page_Load event handler that you have suggested in it? If so, How can I show multiple pages in site map? I want to show all 3 pages listed above in sitemap. And they will also appear in left Panel Bar but all will actually point to same .aspx page
    Is it possible? Or do you recomend any other way to do this?

    Thanks.

    Priti.
  4. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    12 Sep 2017
    02 Dec 2008
    Link to this post
    Hi Priti,

    Check out the following link about how to bind RadPaneBar Data Binding Overview. You need to create a user control and add a code there. The provided snippet gives you some guidance and you need to modified it to get it working on your end.

    Best wishes,
    Ivan Dimitrov
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Register for webinar
4 posts, 0 answered