Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

I have created a web part in SharePoint 2007 which has over 40 controls and I was able to make two different Tool Part classes to hold the different sections of the custom controls. I am converting the part over to SharePoint 2010, and I am having a hard time getting two EditorPartCollection class to work on the same page. How can I have two of these? I am sure it is possible, I am just having a hard time getting this to work. Any help would be appreciated.

 public override EditorPartCollection CreateEditorParts()
    {
        var editor = new ClockEditor
        {
            ID = ID + "_Editor",
            Title = "Custom Clock Editor"
        };
        return new EditorPartCollection(new EditorPart[] { editor });
    }


    public override EditorPartCollection CreateEditorParts()
    {
        var zoneEditor = new ZoneEditor
        {
            ID = ID + "_Editor",
            Title = "Time Zone Editor"
        };
        return new EditorPartCollection(new EditorPart[] { zoneEditor });
    } 
share|improve this question
    
Try EditorPartCollection(ICollection editorParts); –  user21028 Nov 26 '13 at 13:03
add comment

1 Answer 1

up vote 1 down vote accepted

See if this works:

public override EditorPartCollection CreateEditorParts()
{
    var zoneEditor = new ZoneEditor
    {
        ID = ID + "_Editor",
        Title = "Time Zone Editor"
    };
    var editor = new ClockEditor
    {
        ID = ID + "_Editor",
        Title = "Custom Clock Editor"
    };
    return new EditorPartCollection(new EditorPart[] { editor, zoneEditor });
} 
share|improve this answer
    
I tried that and it did not seem to work right. i do not think I did the return new EditorPartCollection(new EditorPart[] { editor, zoneEditor }); part right I am going to try again thanks. I have for now just loaded all of the controls into the one editor part. I really do not want to do this because I have so many controls. It has been much neater to keep them separate. Thanks for the suggestion. –  lazoDev Sep 11 '12 at 17:56
    
That is it. Thanks. I was trying to return two instances of the EditorPartCollection and that is why it was not working. Thank you. I knew there had to be a way I was overlooking. +1 –  lazoDev Sep 11 '12 at 18:04
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.