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

Forums / Developing with Sitefinity / Is there a way to tell which pages use a custom control?

Is there a way to tell which pages use a custom control?

5 posts, 1 answered
  1. Sharon
    Sharon avatar
    39 posts
    Registered:
    14 Jun 2011
    16 Jun 2011
    Link to this post
    I am starting to support a website that contains many custom controls. Is there a way to tell for a given control which pages it is used on?

    Thanks!
  2. Radoslav Georgiev
    Radoslav Georgiev avatar
    3370 posts
    Registered:
    01 Feb 2016
    16 Jun 2011
    Link to this post
    Hi Sharon,

    There is no such feature out of the box. However if you use the Sitefinity API you can get a listing of all pages which use your custom control. You can find more information the Sitefinity 3.x Pages API here. What you should do is to get all pages and then query each page individually to see if it contains your custom control.

    All the best,
    Radoslav Georgiev
    the Telerik team
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  3. Sharon
    Sharon avatar
    39 posts
    Registered:
    14 Jun 2011
    16 Jun 2011
    Link to this post
    How about an ad-hoc SQL query against the Sitefinity DB? Perhaps someone has already written a proc?

    I'm just trying to tell which of the controls are actually being used out of the code I am inheriting. I shouldn't need to do this on a regular basis.

    Thanks!
  4. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    09 Dec 2016
    16 Jun 2011
    Link to this post
    Hello Sharon,

    You can make relation between [sf_CmsCtrlLinks] and [sf_WebControlBase] by ID. In [sf_WebControlBase] you can get the control ID and its type. The check the this control inside sf_CmsCtrlLinks and return the page ID. To get more details about the page you can query PageBase table.

    Greetings,
    Ivan Dimitrov
    the Telerik team
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
    Answered
  5. Sharon
    Sharon avatar
    39 posts
    Registered:
    14 Jun 2011
    20 Jun 2011
    Link to this post
    FWIW, here is the query I used to find this since all the code I inherited had custom somewhere in the path or control name.

    select
    p.Name,
    c.PageID,
    c.ControlID,
    w.Type
    from
    sf_CmsCtrlLinks as c
    inner join sf_WebControlBase w ON c.ControlID=w.ID
    inner join sf_PageBase p ON c.PageID=p.ID
    where
    Type Like '%Custom%'
    Thanks Ivan and Radislov for all your help!
Register for webinar
5 posts, 1 answered