More in this section

page selector

The forums are in read-only mode. In case that you want to directly contact the Progress Sitefinity team use the support center. In our Google Plus group you can find more than one thousand Sitefinity developers discussing different topics. For the Stack Overflow threads don’t forget to use the “Sitefinity” tag.
4 posts, 0 answered
  1. Annie
    Annie avatar
    123 posts
    08 Apr 2009
    15 Jan 2012
    Link to this post

    I would like to use Sitefinity's page selector in a custom module. How do I go about doing that?. Also is there any sample code that I can refer to.

  2. Haroon
    Haroon avatar
    4 posts
    01 Dec 2011
    24 Jan 2012
    Link to this post
    Can please any body answer. it's strange why there is no PageSelector Field in moduleBuilder as we can see ImageSelector and MediaSelector !
  3. Matthew
    Matthew avatar
    6 posts
    20 Jul 2011
    03 Mar 2012
    Link to this post
    I think it's probably not answered mainly because there doesn't appear to be an official way of doing this and this is the Sitefinity 3 Forums? 

    That being said, here's what I think you can do. After creating a dynamic module via Module Builder, a DynamicModulesConfig.config should get generated in the App_Data/Sitefinity/Configurations folder. This should create the views for your dynamic module. There should be 4x views, a BackendList, an BackendInsertView, a BackendPreviewView and a BackendEditView. What I did was to change the view/sections/../field element for an existing TextField. 

    From something like 

    <field rows="1" id="PageControl" dataFieldName="Page" displayMode="Write" wrapperTag="Li" title="Page" fieldType="Telerik.Sitefinity.Web.UI.Fields.TextField" cssClass="sfFormSeparator" fieldName="Page" type:this="Telerik.Sitefinity.Web.UI.Fields.Config.TextFieldDefinitionElement, Telerik.Sitefinity">

    to instead use the PageField like:

    <field rootNodeID="F669D9A7-009D-4D83-DDAA-000000000002" webServiceUrl="~/Sitefinity/Services/Pages/PagesService.svc/" id="PageControl" dataFieldName="Page" displayMode="Write" wrapperTag="Li" title="Page" fieldType="Telerik.Sitefinity.Web.UI.Fields.PageField" cssClass="sfFormSeparator" fieldName="Page" type:this="Telerik.Sitefinity.Web.UI.Fields.Config.PageFieldElement, Telerik.Sitefinity">

    I did this only for the Create and Edit views, I was not concerned about the preview view. You will probably have to use a correct rootNodeID (page_node) if this is not some default rootNodeId. It seems to be working but I did have problems when adding a new field to an existing module specifically for this module. The field for which I change the view control when it was working for a field which existed when the module was created.

    I Hope this helps
  4. Travis
    Travis avatar
    86 posts
    15 Oct 2008
    11 Apr 2012
    Link to this post
    I'm not sure if this is what you're looking for, if not, Matthew's comment will probably suffice. Anyway, my comment relates to using the Page Selector from a custom module. Since I could not find how to do this, I figured I'd post that here, even if it is in the wrong forum (3.x). My comments are related to developing in Sitefinity 5.

    I had the requirement to reference a single page in the site hierarchy from my custom module's content items. I utilized the PageFieldElement control from my modules definitions to accomplish this, as well as couple other pieces of code.

    My content item has a property called PageGroupID. It is a Guid. There is nothing fancy about it in the least, it's just a standard property defined in the following way within my content item class (in this case ParternItem.cs)

    [DataMember, FieldAlias("PageGroupID")]
    public Guid PageGroupID { get { return this.pageGroupID; } set { this.pageGroupID = value; } }

    Then, in my definitions class, I have the following code, within the CreateBackendSections method, when I'm adding all my fields to my detail view:

    var pageGroupField = new PageFieldElement(mainSection.Fields)
        ID = "pageGroupField",
        DataFieldName = "PageGroupID",
        DisplayMode = displayMode,
        Title = "LogoFieldTitle",
        WrapperTag = HtmlTextWriterTag.Li,
        CssClass = "sfUserAvatar",
        ResourceClassId = typeof(PartnersResources).Name,
        RootNodeID = Telerik.Sitefinity.Abstractions.SiteInitializer.FrontendRootNodeId,
        WebServiceUrl = "~/Sitefinity/Services/Pages/PagesService.svc"

    I've specified my RootNodeID as the FrontEndRootNodeID, so you may want to change that, but, that seemed to work for me. I am able to select a page and it remains after save. Hopefully this is of help to someone.

    edit: you'll probably want to change the CSS class, and my title is referencing a junk resource that I just left in there for testing... you'd likely change both of those anyways
Register for webinar
4 posts, 0 answered