Try Now
More in this section

Forums / Developing with Sitefinity / Query Form Responses as per sete in Multisite project

Query Form Responses as per sete in Multisite project

2 posts, 0 answered
  1. TK Interactive
    TK Interactive avatar
    11 posts
    12 Jun 2012
    02 Dec 2014
    Link to this post


    I have a multisite project and wants fetch Form responses per site in a custom control, please help me what is the query to fetch records of form responses per site. Its too urgent, please help.

    Also If possible send me the code how to bind all response records to a repeater control in my custom control. 


  2. Pavel Benov
    Pavel Benov avatar
    341 posts
    14 Mar 2016
    04 Dec 2014
    Link to this post
    Hello Thomas,

    Thank you for contacting us.

    By default, when running Sitefinity in Multisite mode, the current site should be an abstraction when getting the items through the API, as we have this (filtering by the current site items) implemented out of the box.

    When working with the API, by default the majority of our Managers have the implementation to return the items from the default provider of the current site. However, the case with FormsManager is a bit different, since forms do not have providers and thus when using the API you always get all the forms from all the sites and not only the forms from the current site.

    To be able to achieve the desired functionality you will need to get the forms directly from the forms service using the following sample code:

    var formService = new FormsService();
    var formsFromCurrentSite = formService.GetFormDescriptions("", "", 0, 0, false);

    This is the way we filter the forms in the Sitefinity backend for the different sites. The GetFormDescriptions() method of the FormsService.cs has internal logic and methods to get the forms from the current site when the last parameter is set to false. 

    Please note to add the following using statement:
    using Telerik.Sitefinity.Modules.Forms.Web.Services;

    To work only with the entries of the forms you can run the query from our Documentation:


    You can filter the returned entries collection further by SourceSiteId. Something like this:

    items = formsManager.GetFormEntries(entryType, filter, sortExpression, skip, take, ref totalCount).Cast<FormEntry>();
                   if (siteId != Guid.Empty)
                       items = items.Where(item => item.SourceSiteId == siteId);

    To be able to obtain a site's id I would suggest to take a look at the following Forum discussion. We have provided some useful Multisite API queries which you can utilize:


    I hope you find this informative and helpful and please let me know if you have any additional questions.

    Pavel Benov
    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 Sitefinity CMS Ideas&Feedback Portal and vote to affect the priority of the items
2 posts, 0 answered