Determine GridControl and LayoutControl widgets in Sitefinity

Read how you can determine GridControl and LayoutControl widgets inside Sitefinity pages and templates

Daniel Plomp

October 14th, 2021

When you are dealing with larger websites created with Sitefinity, you once in a while need to know where certain LayoutControls or GridControls are placed on the Sitefinity Templates or Pages. If you have a small amount of pages, you can check it manually of course, but for websites with thousands of Pages, this will become cumbersome.

Luckily there are ways to get this information. I'll discuss two methods here.

SQL Queries

One way is to execute SQL queries on your database. This way you can quickly determine, if a specific control is used somewhere on a page or a template.

For pages you can execute this code:

For templates you can execute this code:

Just copy the code inside a new query inside e.g. SQL Server Management Studio to see the results.


Using SQL queries might be an issue if you are not allowed to access the SQL Server / Database on your production site. Also, if you need to build additional functionality like filtering or exporting the results, you will end up using the API to get the needed information.

So the next solution will do the following:

  • Define a class that holds the Export Model

  • Gather the data from pages and templates

  • Format the data as Tab Separated Values (Tsv)

  • Export the data to an Excel file

Define a class that holds the Export Model

What works great is to define a simple model that you can use to export the data to Excel. This way you can name and order the columns more efficiently.

The following code shows an example of such a model:

Gather the data from pages and templates

The first thing we need to do is get the desired data from the Sitefinity Manager(s). In this case, we can do all actions using the PageManager. Be sure that you have enough permissions to access all the Pages and Templates. As a shortcut, you can suppress security on the provider you are using.

The following code shows how to do this:

Format the data as Tab Separated Values

Now that we have the code to gather all the data, we can use the following method to make sure that the data will be available as Tab Separated Values:

Export the data to an Excel file

We now have the right formatted data, to create a .xls file that you can open with Excel. We can do this by using the following code:

When running this code it will download an Excel which holds all the data about your Sitefinity GridControls and LayoutControls that exist on your Pages and Templates!

All rights reserved © ZimplerApps 2021