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

Forums / Bugs & Issues / 'EditPage' is ambiguous because of multiple kinds of members with this name exist in class 'Telerik.Sitefinity.Modules.Pages.PageManager'.

'EditPage' is ambiguous because of multiple kinds of members with this name exist in class 'Telerik.Sitefinity.Modules.Pages.PageManager'.

2 posts, 0 answered
  1. John
    John avatar
    1 posts
    Registered:
    04 Oct 2011
    13 Oct 2011
    Link to this post
    I get the following error message in Visual Studio:
    'EditPage' is ambiguous because of multiple kinds of members with this name exist in class 'Telerik.Sitefinity.Modules.Pages.PageManager'.

    I took the C# example found in the documentation for Creating Pages (which follows):


    public const string UrlNameCharsToReplace = @"[^\w\-\!\$\'\(\)\=\@\d_]+";
    public const string UrlNameReplaceString = "-";
    
    public bool CreatePage( Guid pageId, string pageName )
    {
        var pageDataId = Guid.NewGuid();
        PageManager manager = PageManager.GetManager();
    
        bool exists = manager.GetPageNodes().Where( n => n.Id == pageId ).SingleOrDefault() != null;
    
        if ( exists )
        {
            return false;
        }
    
        PageData pageData = manager.CreatePageData( pageDataId );
        pageData.HtmlTitle = pageName;
        pageData.Title = pageName;
    
        PageNode parent = manager.GetPageNode( SiteInitializer.FrontendRootNodeId );
        PageNode pageNode = manager.CreatePage( parent, pageId, NodeType.Standard );
        pageNode.Page = pageData;
        pageNode.Name = pageName;
        pageNode.Title = pageName;
        pageNode.UrlName = Regex.Replace( pageName.ToLower(), UrlNameCharsToReplace, UrlNameReplaceString );
        pageNode.ShowInNavigation = true;
        pageNode.DateCreated = DateTime.UtcNow;
        pageNode.LastModified = DateTime.UtcNow;
    
        manager.RecompileItemUrls<PageNode>( pageNode );
    
        var draft = manager.EditPage( pageData.Id, true );
        manager.PublishPageDraft( draft, true, null );
        manager.SaveChanges();
    
        return true;
    }

     








    I then ran that code through the Telerik's C# to VB converter and got the following code:

     

     


        Public Const UrlNameCharsToReplace As String = "[^\w\-\!\$\'\(\)\=\@\d_]+"
        Public Const UrlNameReplaceString As String = "-"

        Public Function CreatePage(ByVal pageId As Guid, ByVal pageName As String) As Boolean
            Dim pageDataId = Guid.NewGuid()
            Dim manager As PageManager = PageManager.GetManager()

            Dim exists As Boolean = manager.GetPageNodes().Where(Function(n) n.Id = pageId).SingleOrDefault() IsNot Nothing

            If exists Then
                Return False
            End If

            Dim pageData As PageData = manager.CreatePageData(pageDataId)
            pageData.HtmlTitle = pageName
            pageData.Title = pageName

            Dim parent As PageNode = manager.GetPageNode(SiteInitializer.FrontendRootNodeId)
            Dim pageNode As PageNode = manager.CreatePage(parent, pageId, NodeType.Standard)
            pageNode.Page = pageData
            pageNode.Name = pageName
            pageNode.Title = pageName
            pageNode.UrlName = Regex.Replace(pageName.ToLower(), UrlNameCharsToReplace, UrlNameReplaceString)
            pageNode.ShowInNavigation = True
            pageNode.DateCreated = DateTime.UtcNow
            pageNode.LastModified = DateTime.UtcNow

            manager.RecompileItemUrls(Of PageNode)(pageNode)

            Dim draft = manager.EditPage(pageData.Id, True)

            'manager.PublishPageDraft(draft, True, Nothing)     'This code is from Sitefinity's example, which is apparently, now obsolete.
            manager.PublishPageDraft(draft, Nothing)
            manager.SaveChanges()

            Return True
        End Function




     

    The line that generates the error is:

     

    Dim draft = manager.EditPage(pageData.Id, True)

     

     

     

     

     

    Any ideas?








  2. Stanislav Velikov
    Stanislav Velikov avatar
    1113 posts
    Registered:
    16 Aug 2017
    17 Oct 2011
    Link to this post
    Hello John,

    When you get the ambiguous error you should click on it to see at which line is the ambiguous reference.
    For example you can say
    manager.Telerik.Sitefinity.Modules.Pages.PageManager.EditPage( pageData.Id, true );
    This way Edit will know specifically which of the referenced assemblies to use to call EditPage method.
    
    Best wishes,
    Stanislav Velikov
    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
2 posts, 0 answered