I have a RadScheduler with a RadSchedulerContextMenu that shows when the user right clicks an appointment. Inside that RadSchedulerContextMenu, I have several RadMenuItems, some of which are disabled. One of the RadMenuItems is Text="Edit" Value="CommandEdit" Enabled="False", however, it is NOT disabled. The other items are disabled when I set Enabled="false", but not the Edit item.
<telerik:RadSchedulerContextMenu runat="server" ID="ContextMenuNone" Skin="Vista" >
<Items>
<telerik:RadMenuItem Text="Edit" Value="CommandEdit" ImageUrl="~/edit.png" Enabled="false" />
...
</Items>
</telerik:RadSchedulerContextMenu>
| ... |
| <body topmargin="0" leftmargin="0"> |
| <form id="form1" runat="server"> |
| <div> |
| <telerik:RadScriptManager ID="RadScriptManager1" runat="server"> |
| </telerik:RadScriptManager> |
| <telerik:RadPanelBar ID="rpbNavigation" runat="server" style="width:100%" Skin="Outlook" EnableViewState="false"> |
| </telerik:RadPanelBar> |
| </div> |
| </form> |
| <telerik:RadCodeBlock ID="RadCodeBlock2" runat="server"> |
| <script type="text/javascript"> |
| checkMain(); |
| function checkMain() { |
| var panelBar = $find("<%= rpbNavigation.ClientID %>"); |
| var item = panelBar.findItemByText(Main.selectedModule); |
| } |
| </script> |
| </telerik:RadCodeBlock> |
| </body> |
| ... |
<telerik:RadPanelBar runat="server" ID="RadPanelBar1" > <Items> <telerik:RadPanelItem Expanded="True" Text="Corporate" ChildGroupHeight="50"> <Items> <telerik:RadPanelItem Text="About us"> <Items> <telerik:RadPanelItem Text="News"></telerik:RadPanelItem> <telerik:RadPanelItem Text="Team"></telerik:RadPanelItem> </Items> </telerik:RadPanelItem> <telerik:RadPanelItem Text="Careers"></telerik:RadPanelItem> <telerik:RadPanelItem Text="Careers1"></telerik:RadPanelItem> <telerik:RadPanelItem Text="Careers2"></telerik:RadPanelItem> <telerik:RadPanelItem Text="Careers3"></telerik:RadPanelItem> <telerik:RadPanelItem Text="Careers4"></telerik:RadPanelItem> <telerik:RadPanelItem Text="Careers5"></telerik:RadPanelItem> </Items> </telerik:RadPanelItem> <telerik:RadPanelItem Text="Services" ChildGroupHeight="50"> <Items> <telerik:RadPanelItem Text="Products"></telerik:RadPanelItem> <telerik:RadPanelItem Text="Solutions"></telerik:RadPanelItem> <telerik:RadPanelItem Text="Certifications"></telerik:RadPanelItem> </Items> </telerik:RadPanelItem> <telerik:RadPanelItem Text="Work" ChildGroupHeight="50" > <Items> <telerik:RadPanelItem Text="Clients"></telerik:RadPanelItem> <telerik:RadPanelItem Text="Testimonials"></telerik:RadPanelItem> <telerik:RadPanelItem Text="FAQ"></telerik:RadPanelItem> </Items> </telerik:RadPanelItem> </Items> <ExpandAnimation Type="None"></ExpandAnimation> </telerik:RadPanelBar><a onclick="if(!$find('ctl00_WebPartManager_WorkAreaWebPart_MainControl_WorkAreaGrid_ctl00').fireCommand('DisplayDetails','0')) return false;" href="javascript:__doPostBack('ctl00$WebPartManager$WorkAreaWebPart$MainControl$WorkAreaGrid$ctl00$ctl04$ctl01','')">J1542A</a><br>| string assetsRoot = "~/Assets112s/"; //this is the name of my virtual directory |
| RadEditor1.ImageManager.ViewPaths = new string[1] { assetsRoot + "Images" }; |

I need to create a combobox with variable number of columns. Both the number of columns, and the column names would be determined only at run time. Also, I need the combobox to be a multiselect combo, so I need to put in a checkbox in the item template. So, I am creating the item template and header template at runtime.
When I run the code, I am getting the error "Multiple controls with the same ID 'chkSourceElementValue' were found. FindControl requires that controls have unique IDs." where chkSourceElementValue is the ID of the checkbox thats created in the item template. I am setting the item template, header template, data source at page_load and also data binding it at that point. I have enclosed snippets of my code, as well as the error message stack below. it looks like the error is originating from within RadComboBox.
I am using the latest version of Telerik ASP.NET AJAX Controls (ASP.NET AJAX Q3 2010 NET 35)
Please advise at the earliest. Thank you.
Page_Load:
this
.rcbSourceElement.ItemTemplate = new SourceElementValueDropDownTemplate(ListItemType.Item, iCountOfColumnsInDataset, mColumnNamesToDisplay);
this.rcbSourceElement.HeaderTemplate = new SourceElementValueDropDownTemplate(ListItemType.Header, iCountOfColumnsInDataset, mColumnNamesToDisplay);
this.rcbSourceElement.DataSource = dsSourceElementValuesForDisplay;
this.rcbSourceElement.DataBind();
public class SourceElementValueDropDownTemplate : ITemplate
{
PlaceHolder ph = new PlaceHolder();
private ListItemType CurrentTemplateType { get; set; }
private int CountOfColumns { get; set; }
private string[] ColumnHeaders { get; set; }
public SourceElementValueDropDownTemplate(ListItemType type, int countOfColumnsInDropDown, string[] columnHeaders)
{
CurrentTemplateType = type;
CountOfColumns = countOfColumnsInDropDown;
ColumnHeaders = columnHeaders;
}
void ITemplate.InstantiateIn(Control container)
{
CheckBox chkSourceElementValue;
Label lblSourceElementValue;
switch(CurrentTemplateType)
{
case ListItemType.Header:
ph.Controls.Add(new LiteralControl("<ul>"));
foreach(string mColName in ColumnHeaders)
{
ph.Controls.Add(new LiteralControl("<li class='rcbColumn'>"));
ph.Controls.Add(new LiteralControl(mColName));
ph.Controls.Add(new LiteralControl("</li>"));
}
ph.Controls.Add(new LiteralControl("</ul>"));
container.Controls.Add(ph);
break;
case ListItemType.Item:
ph.Controls.Add(new LiteralControl("<ul>"));
for (int iRCbColCtr = 1; iRCbColCtr < CountOfColumns ; iRCbColCtr++) /* First column of the dataset is expected to be the ELEMENT_VALUE_KEY. No need to show that in a column */
{
ph.Controls.Add(new LiteralControl("<li class='rcbColumn'>"));
if (iRCbColCtr == 1) // This is the first column - must appear as a checkbox
{
chkSourceElementValue = new CheckBox();
chkSourceElementValue.ID = "chkSourceElementValue";
chkSourceElementValue.Attributes.Add("ColIndex", iRCbColCtr.ToString());
chkSourceElementValue.DataBinding += new EventHandler(chkSourceElementValue_DataBinding);
//chkSourceElementValue.CheckedChanged += new EventHandler(chkSourceElementValue_CheckedChanged);
ph.Controls.Add(chkSourceElementValue);
}
else
{
lblSourceElementValue = new Label();
lblSourceElementValue.ID = "lblSourceElementValue";
lblSourceElementValue.Attributes.Add("ColIndex", iRCbColCtr.ToString());
lblSourceElementValue.DataBinding += new EventHandler(lblSourceElementValue_DataBinding);
ph.Controls.Add(lblSourceElementValue);
}
ph.Controls.Add(new LiteralControl("</li>"));
}
ph.Controls.Add(new LiteralControl("</ul>"));
//ph.DataBinding += new EventHandler(ph_DataBinding);
container.Controls.Add(ph);
break;
}
}
void chkSourceElementValue_CheckedChanged(object sender, EventArgs e)
{
CheckBox chkSourceElementValue = sender as CheckBox;
RadComboBox rcbParentCombo = chkSourceElementValue.Parent as RadComboBox;
}
void lblSourceElementValue_DataBinding(object sender, EventArgs e)
{
Label lblSourceElementValue = (sender) as Label;
int iColIndex = Convert.ToInt16(lblSourceElementValue.Attributes["ColIndex"]);
RadComboBoxItem container = (RadComboBoxItem)lblSourceElementValue.NamingContainer;
lblSourceElementValue.Text = ((DataRowView)(container.DataItem))[iColIndex].ToString();
}
void chkSourceElementValue_DataBinding(object sender, EventArgs e)
{
CheckBox chkSourceElementValue = (sender) as CheckBox;
int iColIndex = Convert.ToInt16(chkSourceElementValue.Attributes["ColIndex"]);
RadComboBoxItem container = (RadComboBoxItem)chkSourceElementValue.NamingContainer;
chkSourceElementValue.Text = ((DataRowView)(container.DataItem))[iColIndex].ToString();
}
}