1

I created a Button on the ribbon "SelectCp".

OnClick of the button I am launching a custom aspx page.

Custom aspx page is having a dropdown with the items like.

  1. Select CP
  2. Etc

Now, when user will select the option "Select CP", I need to populate all the publication in a listitem on the aspx page. When user will select a publication, I need to populate all the component in another list.

Can anyone give an idea how to proceed?

ADDED

I am proceeding Like this, but its not giving the list of publication in the listbox on the aspx page.

protected void ddSelectOption_SelectedIndexChanged(object sender, EventArgs e)
    {
        //CommonTridionTools objCmnUnPub = new CommonTridionTools();
        CoreServiceSession client = new CoreServiceSession();
        SessionAwareCoreServiceClient csClient = client.GetClient();
        ReadOptions readoption = new ReadOptions();
        List<string> PublicationList = new List<string>();
        List<string> ComponentList = new List<string>();

        if (ddSelectOption.SelectedItem.Equals("Select CP"))
        {
            FolderData RootFolder =(FolderData)csClient.Read(tridionPageId, readoption);
            var filter = new OrganizationalItemItemsFilterData
            {
                Recursive = true,
                ItemTypes = new ItemType[] { ItemType.Publication,ItemType.Component, ItemType.ComponentTemplate },
            };
            XElement CompList = csClient.GetListXml(RootFolder.Id,filter);

            foreach (var comp in CompList.Elements())
            {
                PublicationData Publication =(PublicationData)csClient.Read(comp.Attribute("ID").Value, readoption);
                var MetadataXML = new XmlDocument();
                MetadataXML.LoadXml(Publication.Metadata);
                PublicationList.Add(Publication.Id)
                lbPublication.DataSource = PublicationList;

            }
        }
SDLBeginner
  • 829
  • 1
  • 7
  • 19
  • There are literally dozens of examples all over the place of people interacting with Tridion and writing GUI extensions. Did you try those? Where did you get stuck? http://mattgemmell.com/2008/12/08/what-have-you-tried/ – Frank van Puffelen Jul 28 '12 at 11:50

3 Answers3

3

We have examples for such a Publication drop-down and other controls on the PowerTools 2011 open source project. See the Example Extension source for:

Start by reviewing these, then share your code or start another question when you're ready.

Note the nice volunteers for the project created a base class that does some of the work.

Alvin Reyes
  • 2,889
  • 16
  • 38
2

A great example of allowing the user to select items, can be found in the Item Selector extension.

It has most of the parts that you are asking for, although not necessarily in a copy/paste format. Study it and reach out to us if you get stuck modifying it to your needs or if a certain part is not clear.

Frank van Puffelen
  • 565,676
  • 79
  • 828
  • 807
1

This Item Selector Extension is nice of course, but since the amount of Publications doesn't change very often you could also consider retrieving the data for this list from a configuration file.

This way you can also much easier filter this list with only the appropriate Publications, not just the ones a user has access to.

Arjen Stobbe
  • 1,684
  • 9
  • 15
  • Thanks arjen . Please have a look how i am proceeding, but using this i am not able to get list of publication in the listbox on the aspx page. Kindly make me correct if i am wrong direction. – SDLBeginner Jul 31 '12 at 13:33
  • You're trying to get a Publication using the Component ID. – Arjen Stobbe Aug 01 '12 at 05:41
  • :I was committing few mistakes there in my code. Now i corrected that and i am getting now component and component template in two different lists on selecting a Publication. – SDLBeginner Aug 01 '12 at 07:32