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

Forums / Developing with Sitefinity / Sql Query to get a control type and all pages its on

Sql Query to get a control type and all pages its on

2 posts, 1 answered
  1. Steve
    Steve avatar
    3037 posts
    Registered:
    03 Dec 2008
    05 Oct 2010
    Link to this post
    Does anyone have a .sql I can borrow to find out which pages a certain control exists on assuming I don't have access to look at anything but my Sql Management studio... :)
  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    09 Dec 2016
    05 Oct 2010
    Link to this post
    Hello Steve,

    You can use the API to get this information by looping through controls collection of each page. You can get all pages by calling GetPages method of CmsManager class. Then get the StagedPage object of each ICmsPage/IPage item inside the list of all pages that GetPages returns and loop through the controls.

    The easiest option would be to query the database tables.
    sf_CmsCtrlLinks - contains relation between page ID and Control ID.
    sf_WebControlBase -contains control ID and Type of the control
    sf_PageBase contains the page name.

    sample

    SELECT
     
    [CMDEV3].[dbo].[sf_CmsCtrlLinks].[LangID],
     
    [CMDEV3].[dbo].[sf_CmsCtrlLinks].[PageID],
     
    [CMDEV3].[dbo].[sf_CmsCtrlLinks].[ControlID]
     
    FROM[CMDEV3].[dbo].[sf_CmsCtrlLinks] JOIN[CMDEV3].[dbo].[sf_WebControlBase] ON
     
    [CMDEV3].[dbo].[sf_CmsCtrlLinks].[ControlID] = [CMDEV3].[dbo].[sf_WebControlBase].[ID]
     
    WHERE Type LIKE'Telerik.Cms.Engine.WebControls.GenericContent'+ '%'


    This will return page IDs of all pages on which you have control with type Telerik.Cms.Engine.WebControls.GenericContent. After that you have to query sf_PageBase and make a JOIN ON the page ID if you want to get the page name



    Sincerely yours,
    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
    Answered
2 posts, 1 answered