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

Forums / Developing with Sitefinity / Get Page Controls

Get Page Controls

2 posts, 0 answered
  1. Siddesh Kapadi
    Siddesh Kapadi avatar
    239 posts
    Registered:
    09 Oct 2009
    06 Sep 2010
    Link to this post
    Hey,
    I have a news control on  my page, which has a Read More News Link. I redirect the user to the different page with the page ID of the current page with control  of read more news link. I require the control on previous page and the values configured for that control on the previous page like for example news categories, title of the control, etc.

    Please let me now how can I acheive this.

    Regards,
    Siddesh Kapadi
  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    09 Dec 2016
    06 Sep 2010
    Link to this post
    Hi Siddesh Kapadi,

    You can get the page ID of the previous page and then its staged version. Then loop through page's  ICmsWebControl controls collection and get a control of type NewsView. Once you get access to the control you can read all public properties.


    sample

    var cmsManager = new Telerik.Cms.CmsManager();
    Telerik.Cms.ICmsPage page = cmsManager.GetPage(new Guid("here set the page id"));
    var pageControls = page.Staged.Controls;
     
    foreach (Telerik.Cms.ICmsWebControl webCtrl in pageControls)
    {
     if (webCtrl.ContainerID == "MyContainer" && webCtrl.ControlType == typeof(NewsView))
     {
     
         NewsView nvCtrl = webCtrl.LoadControl() as NewsView;
         
     }
    }


    Regards,
    Ivan Dimitrov
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
2 posts, 0 answered