RadToolBar1.Items.FindItemByValue("buttonValue").Visible = true;
It results in the following exception:
Value property is not supported by RadToolBarDropDown
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Exception: Value property is not supported by RadToolBarDropDown
This makes using it very difficult (indeed impossible).
I note that this has come up before but it seems like the problem is being ignored
23 Answers, 1 is accepted

Unfortunately, I am not able to open the forum (I assume it to be) that you gave a link to. However, to be able to find a Child Button located in RadToolBarDropDown you will only need to use the following code (no need to search in the Items):
markup:
<
telerik:RadToolBar
ID
=
"RadToolBar1"
runat
=
"server"
>
<
Items
>
<
telerik:RadToolBarButton
runat
=
"server"
Text
=
"Button 0"
Value
=
"button1"
>
</
telerik:RadToolBarButton
>
<
telerik:RadToolBarButton
runat
=
"server"
Text
=
"Button 1"
>
</
telerik:RadToolBarButton
>
<
telerik:RadToolBarButton
runat
=
"server"
Text
=
"Button 2"
>
</
telerik:RadToolBarButton
>
<
telerik:RadToolBarButton
runat
=
"server"
Text
=
"Button 3"
>
</
telerik:RadToolBarButton
>
<
telerik:RadToolBarDropDown
runat
=
"server"
Text
=
"DropDown 0"
>
<
Buttons
>
<
telerik:RadToolBarButton
runat
=
"server"
Text
=
"Child Button 1"
Value
=
"value1"
>
</
telerik:RadToolBarButton
>
<
telerik:RadToolBarButton
runat
=
"server"
Text
=
"Child Button 2"
>
</
telerik:RadToolBarButton
>
</
Buttons
>
</
telerik:RadToolBarDropDown
>
</
Items
>
</
telerik:RadToolBar
>
code behind:
protected
void
Page_Load(
object
sender, EventArgs e)
{ RadToolBar1.FindItemByValue(
"value1"
).Visible =
false
;
}
Kind regards,
Kate
the Telerik team
Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.


I am encountering the same problem.
I cannot use your workaround because I need access to the .Checked property which is not in the Item base class:
RadToolBar1.Items.FindItemByValue("groupingEditor").checked
'checked' is not a member of 'Telerik.Web.UI.RadToolBarItem'.
Here is my code:
Dim btn As Telerik.Web.UI.RadToolBarButton = RadToolBar1.Items.FindItemByValue("groupingEditor")
System.Exception was unhandled by user code
Message: Value property is not supported by RadToolBarDropDown
This is raised because there is a drop down on the toolbar and the
FindItemByValue
function still contains a bug in 2012.1.You need to cast the item to the correct type so you can access the Check property of the control. You can refer to the below example:
<
telerik:RadToolBar
ID
=
"RadToolBar1
"
runat
=
"server"
>
<
Items
>
<
telerik:RadToolBarDropDown
EnableDefaultButton
=
"false"
Text
=
"Suspend"
runat
=
"server"
>
<
Buttons
>
<
telerik:RadToolBarButton
Text
=
"Suspend Projects"
runat
=
"server"
Value
=
"1"
>
</
telerik:RadToolBarButton
>
<
telerik:RadToolBarButton
Text
=
"Suspend Workflows"
runat
=
"server"
>
</
telerik:RadToolBarButton
>
<
telerik:RadToolBarButton
Text
=
"Resume Projects"
runat
=
"server"
>
</
telerik:RadToolBarButton
>
<
telerik:RadToolBarButton
Text
=
"Resume Workflows"
runat
=
"server"
>
</
telerik:RadToolBarButton
>
</
Buttons
>
</
telerik:RadToolBarDropDown
>
<
telerik:RadToolBarButton
runat
=
"server"
Text
=
"button0"
Value
=
"2"
>
</
telerik:RadToolBarButton
>
<
telerik:RadToolBarButton
runat
=
"server"
Text
=
"button1"
>
</
telerik:RadToolBarButton
>
<
telerik:RadToolBarButton
runat
=
"server"
Text
=
"button2"
>
</
telerik:RadToolBarButton
>
</
Items
>
</
telerik:RadToolBar
>
code behind:
protected
void
Page_Load(
object
sender, EventArgs e)
{
var button1 = (RadToolBarButton)RadToolBar1
.FindItemByValue(
"1"
);
button1.Checked =
true
;
}
Greetings,
Kate
the Telerik team

<
telerik:RadToolBar
runat
=
"server"
ID
=
"RadToolBar1"
OnClientDropDownClosing
=
"DropDownClosing"
OnClientButtonClicked
=
"ToolbarButtonClick"
OnButtonClick
=
"RadToolbar_ButtonClicked"
EnableViewState
=
"false"
>
<
Items
>
<
telerik:RadToolBarDropDown
EnableDefaultButton
=
"true"
ImageUrl
=
"Images/search.gif"
DropDownWidth
=
"200px"
DefaultButtonIndex
=
"0"
Text
=
"View"
runat
=
"server"
>
<
Buttons
>
<
telerik:RadToolBarButton
Text
=
"Last 24 Hours"
ImageUrl
=
"Images/twentyfourhours.png"
runat
=
"server"
CheckOnClick
=
"True"
Group
=
"Views"
></
telerik:RadToolBarButton
>
<
telerik:RadToolBarButton
Text
=
"Last 3 Days"
ImageUrl
=
"Images/notes.gif"
runat
=
"server"
CheckOnClick
=
"True"
Group
=
"Views"
></
telerik:RadToolBarButton
>
<
telerik:RadToolBarButton
Text
=
"Last Week"
ImageUrl
=
"Images/calendar.gif"
runat
=
"server"
CheckOnClick
=
"True"
Group
=
"Views"
></
telerik:RadToolBarButton
>
<
telerik:RadToolBarButton
Text
=
"Unread"
ImageUrl
=
"Images/unread.png"
runat
=
"server"
CheckOnClick
=
"True"
Group
=
"Views"
></
telerik:RadToolBarButton
>
<
telerik:RadToolBarButton
Text
=
"Flagged"
ImageUrl
=
"Images/followUp.gif"
runat
=
"server"
CheckOnClick
=
"True"
Group
=
"Views"
></
telerik:RadToolBarButton
>
<
telerik:RadToolBarButton
Value
=
"since"
Group
=
"Views"
CheckOnClick
=
"True"
ImageUrl
=
"Images/windows.png"
Text
=
"Since..."
>
<
ItemTemplate
>
<
table
>
<
tr
>
<
td
style
=
"width:40px;"
>
<
img
src
=
"Images/windows.png"
/>
</
td
>
<
td
>
<
telerik:RadDatePicker
ID
=
"dtSince"
Runat
=
"server"
PopupDirection
=
"BottomRight"
ZIndex
=
"2000000"
>
</
telerik:RadDatePicker
>
</
td
>
</
tr
>
</
table
>
</
ItemTemplate
>
</
telerik:RadToolBarButton
>
<
telerik:RadToolBarButton
Text
=
"Reset View"
ImageUrl
=
"Images/search.gif"
runat
=
"server"
CheckOnClick
=
"True"
Group
=
"Views"
></
telerik:RadToolBarButton
>
</
Buttons
>
</
telerik:RadToolBarDropDown
>
</
Items
>
</
telerik:RadToolBar
>
Ultimately, I want all of the RadToolBarButtons within the RadToolBarDropDown to rrespond to a button click. Since there is no button click for the RadDatePicker within the template, I was hoping to attempt to handle that on the client. Any way out of this problem?
One way I can think of is that you use the client-side OnDateSelected event and show the dropdown of the RadToolBar control whenever you select a date. For instance you can use the following code:
<script type=
"text/javascript"
>
function
OnDateSelected() {
var
tb1 = $find(
"RadToolBar1"
);
var
dd = tb1.findItemByText(
"View"
);
tb1.set_collapseAnimation(
'0'
);
tb1.set_expandAnimation(
'0'
);
dd.showDropDown();
}
</script>
markup:
<
telerik:RadDatePicker
ID
=
"dtSince"
runat
=
"server"
PopupDirection
=
"BottomRight"
ZIndex
=
"2000000"
ClientEvents-OnDateSelected
=
"OnDateSelected"
> </
telerik:RadDatePicker
>
All the best,
Kate
the Telerik team


Also, the "get_dropDownElement()" is not listed in the link you sent so you may need to update your notes.


You can use the findItemByText() method to get the instance of a particular item as follows.
JavaScript:
var
Toolbar = $find(
"<%=RadToolBar1.ClientID %>"
);
var
toolbarDropdown = Toolbar.findItemByText(
"DropDownItem1"
);
// accessing the toolbar dropdown
var
toolbarButton = Toolbar.findItemByText(
"ButtonItem1"
);
//accessing the toolbar button
Please have a look into the following help help documentation to get more information about RadToolBar and RadToolBarItem client object.
RadToolBar Client Object
RadToolBarItem Client Object
Thanks,
Shinu.



In order to get the Items of RadToolBar try to use the methods findItemByText() or findItemByValue(), will returns the item in the toolbar with the specified text or value respectively. For accessing the controls inside the RadToolBarItem use the method findControl. This is the best approach to accessing controls in the RadToolBar and RadToolBarItem.
Thanks,
Shinu.


With reference to this forum thread RadToolBarDropDown doesn't have Value attribute. So the way of accessing RadToolbarDropDown from client side is by using findItemText. Can you please elaborate the statement "user can customize the text", how it is performed?
Thanks,
Shinu.

Indeed the RadToolBar RadToolBarDropDown does not have Value property and this request is already logged in our system. Here you can track its progress and vote for it. At this point the only solution is to find the item by text.
Regards,
Boyan Dimitrov
Telerik
Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

Hello Albert,
Here is the Feature request for the Value server-side property of the ToolBarDropDown:
Actually, the attributes are available for the server-side items as well. You can add them either in the markup or from the code-behind. The runat=server for the item markup is not necessary, it will still work but Visual Studio might underline it as a warning.
Here is an easy way how to add an attribute and find the item by attribute from the code behind.
<telerik:RadToolBar runat="server" ID="RadToolbar1">
<Items>
<telerik:RadToolBarDropDown data-id="my-dropdown-item">
<Buttons>
<telerik:RadToolBarButton Text="Button markup"></telerik:RadToolBarButton>
</Buttons>
</telerik:RadToolBarDropDown>
</Items>
</telerik:RadToolBar>
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
var ddl = RadToolbar1.FindItem(x => x.Attributes["data-id"] == "my-dropdown-item") as RadToolBarDropDown;
ddl.Buttons.Add(new RadToolBarButton("Button code behind"));
}
}
Also, the Value property for the dropdown would be unreliable as an identifier, especially if it assumes the value of the selected button. In such a case, I strongly recommend using the attributes method for identifying RadToolBarDropDown items.
Regards,
Peter Milchev
Progress Telerik
Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

Hello Albert,
FindItemByAttribute is a good suggestion and fortunately you can easily make it as an extension method until it is built-in:
public static class TelerikToolBarExtensions{
public static RadToolBarItem FindItemByAttribute(this RadToolBar toolbar, string attribute, string value)
{
return toolbar.FindItem(x => x.Attributes["data-id"] == "my-dropdown-item");
}
}
public partial class Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
//var ddl = RadToolbar1.FindItem(x => x.Attributes["data-id"] == "my-dropdown-item") as RadToolBarDropDown;
var ddl = RadToolbar1.FindItemByAttribute("data-id","my-dropdown-item") as RadToolBarDropDown;
ddl.Buttons.Add(new RadToolBarButton("Button code behind"));
}
}
}
Regards,
Peter Milchev
Progress Telerik
Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.