Do you know hoy to add items to a dropdown? I have the following ascx code:

<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="AddComponentToBundleXPM.ascx.cs" Inherits="GUIPageViewExtension.AddComponentToBundleXPM" %>

<%@ Import Namespace="Tridion.Web.UI" %>

<c:RibbonItemsGroup runat="server" ID="RibbonItemsGroup">
    <c:RibbonButton runat="server" CommandName="ViewStaging" Title="View in Staging" Label="View In Staging" ID="ViewStagingBtn" />
    <c:RibbonButton runat="server" CommandName="ViewLive" Title="View in Live" Label="View in Live" ID="ViewLiveBtn" />
    <c:Dropdown ID="listComponentTemplates" runat="server" nullable="false" />
</c:RibbonItemsGroup>

In codebehind, when I try to add items to this Dropdown, it doesn´t recognized this element (with ID listComponentTemplates). This is the code:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Tridion.Web.UI.Core.Controls;

namespace GUIPageViewExtension
{
    [ControlResources("GUIPageViewExtension.AddComponentToBundleXPM")]
    public partial class AddComponentToBundleXPM : Tridion.Web.UI.Controls.TridionUserControl
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            for (int i = 0; i < 7; i++)
            {
                ListItem element = new ListItem("Text " + i.ToString());
                this.listComponentTemplate.
            }


        }
    }
}

What could be the problem? Is there any way to do something like that?

  • your posted code here seems incomplete – Velmurugan Jun 28 '17 at 8:23
  • 1
    Hi Sergio. Did you get to the bottom of this? It may be worth looking at the following SO question and accepted answer suggesting a recreation of the AddComponentToBundleXPM.designer.cs file: stackoverflow.com/questions/1316757/… – Jonathan Williams Jun 29 '17 at 13:22

Your Answer

 

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Browse other questions tagged or ask your own question.