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

Forums / Developing with Sitefinity / Programmatically calling Site TabStrip

Programmatically calling Site TabStrip

4 posts, 0 answered
  1. sarath
    sarath avatar
    24 posts
    Registered:
    24 Jan 2010
    08 Feb 2010
    Link to this post
    Hi,

    I have master page which is used for CMS pages and I have a master page which is used for static pages. In the CMS master I added top menu user control. I want to pull this top menu(site tabstrip) programmatically from static master and use it for static pages. When  ever I update in the cms user control, the same needs to be update in the static pages too. how to pull the site tabstrip dynamically.

    Thanks,
    Sarath
  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    16 Jun 2017
    08 Feb 2010
    Link to this post
    Hi sarath,

    1. You can use the same control on both pages and use com mom datasource.
    2. If you want to have the same properties set for your static RadTabStrip control as you have set to the CMS page RadTabStrip, you need to get the CMS RadTabStrip on each request, check its properties and then set the same on the static RadTabStrip.

    Sample

    var Manager = new CmsManager();
    ICmsPage page = (ICmsPage)Manager.GetPage(someID, true);
     
    if (page != null)
    {
        IStagedPage staged = p.Staged.CheckOut();
        foreach (ICmsWebControl c in staged.Controls)
        {
            if (c.ControlType.Name == "RadTabStrip")
            {
                Control control = c.LoadControl(this);
                RadTabStrip mycontrol = control as RadTabStrip;
                // here you have access to the control properties
                // you can get the static control in similar way
                // and update its properties.
            }
        }
    }


    Best wishes,
    Ivan Dimitrov
    the Telerik team

    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
    Follow the status of features or bugs in PITS and vote for them to affect their priority.
  3. sarath
    sarath avatar
    24 posts
    Registered:
    24 Jan 2010
    08 Feb 2010
    Link to this post
    Hi,

    Thank you for your reply.

    Here the problem is my top menu is a user control(tabstrip.ascx). How to load the user control dynamically and that will call from a master page and needs to be render for all the static pages.

    Thanks,
    sarath.
  4. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    16 Jun 2017
    08 Feb 2010
    Link to this post
    Hello sarath,

    You could get the type of the control as shown below

    foreach (ICmsWebControl cntrl in staged.Controls)
    {
        if (cntrl.IsAscx && cntrl.TypeName == "~/tabStrip.ascx")
           {
              Control c = cntrl.LoadControl(this.Page);
              tabStrip mycontrol = c as tabStrip
           }
     }

    Note that this code allows you to access the control properties. In all other cases the common data source solves your problem.

    Kind regards,
    Ivan Dimitrov
    the Telerik team

    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
    Follow the status of features or bugs in PITS and vote for them to affect their priority.
Register for webinar
4 posts, 0 answered