Completed
Last Updated: 02 Dec 2021 16:14 by ADMIN
Release R1 2022
ADMIN
Telerik Admin
Created on: 28 May 2010 10:37
Category: ToolBar
Type: Feature Request
21
IMPROVE: Add Value property to RadToolBarDropDown
1 comment
ADMIN
Rumen
Posted on: 02 Dec 2021 16:14

Here is an example of how to access the dropdown items via the FindDropDownByValue method:

ASPX

<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" Value="MyDropDown">
            <Buttons>
                <telerik:RadToolBarButton runat="server" Text="Child Button 1" Value="value1">
                </telerik:RadToolBarButton>
                <telerik:RadToolBarButton runat="server" Text="Child Button 2" Value="value2">
                </telerik:RadToolBarButton>
                <telerik:RadToolBarButton runat="server" Text="Child Button 3" Value="value3">
                </telerik:RadToolBarButton>
            </Buttons>
        </telerik:RadToolBarDropDown>
    </Items>
</telerik:RadToolBar>

 

C#

 

    protected void Page_Load(object sender, EventArgs e)
    {
        var dropdown1 = RadToolBar1.FindItemByValue("MyDropDown") as RadToolBarDropDown;
        dropdown1.Buttons[0].Text = "Changed button";

        var dropdown2 = RadToolBar1.FindDropDownByValue("MyDropDown");
        dropdown2.Buttons.FindItemByValue("value2").Text = "Changed button text from FindDropDownByValue";

        var dropdown3 = RadToolBar1.Items.FindItemByValue("MyDropDown") as RadToolBarDropDown;
        dropdown3.Buttons.FindItemByValue("value3").Text = "Changed button text from Items.FindItemByValue ";

    }

 

VB.NET

 

Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs)
    Dim dropdown1 = TryCast(RadToolBar1.FindItemByValue("MyDropDown"), RadToolBarDropDown)
    dropdown1.Buttons(0).Text = "Changed button"
Dim dropdown2 = RadToolBar1.FindDropDownByValue("MyDropDown") dropdown2.Buttons.FindItemByValue("value2").Text = "Changed button text from FindDropDownByValue"
Dim dropdown3 = TryCast(RadToolBar1.Items.FindItemByValue("MyDropDown"), RadToolBarDropDown) dropdown3.Buttons.FindItemByValue("value3").Text = "Changed button text from Items.FindItemByValue "
End Sub