This may be really simple...

3 posts, 0 answers
  1. Ciaran
    Ciaran avatar
    21 posts
    Member since:
    Jun 2008

    Posted 09 Jan 2009 Link to this post

    but its annoying the hell out of me right now

    I simply need the text value of a rad toolbar item

    I have no problem doing what I need in the ButtonClick event but I need the value based on other events on the page

    any ideas?

    Radtoolbar1.item.text doesnt do it for me
  2. Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 12 Jan 2009 Link to this post

    Hello Ciaran,

    I tried the following code to get the text of a RadToolBar item and it worked as expected.
    <telerik:RadToolBar ID="RadToolBar1" Width="1000px" runat="server"
            <telerik:RadToolBarButton Text="Text1"></telerik:RadToolBarButton> 
            <telerik:RadToolBarButton Text="Text2" CssClass="Button"></telerik:RadToolBarButton> 
            <telerik:RadToolBarButton Text="Text3" CssClass="Button"></telerik:RadToolBarButton> 
            <telerik:RadToolBarButton Text="Text4" CssClass="Button"></telerik:RadToolBarButton> 

    protected void Page_Load(object sender, EventArgs e) 
            string strtxt = RadToolBar1.Items[0].Text; 

  3. Peter
    Peter avatar
    6637 posts

    Posted 12 Jan 2009 Link to this post


    Indexing the Items collection is one possible way to do this. Alternatively, you can use the FindItemByValue/Text/Attribute methods. Here is a simple example:

     <telerik:RadToolBar ID="RadToolBar1" runat="server">  
    <CollapseAnimation Type="OutQuint" Duration="200"></CollapseAnimation> 
                <telerik:RadToolBarButton runat="server" Value="A" Text="Button 0">  
                <telerik:RadToolBarButton runat="server" Value="B" Text="Button 1">  
                <telerik:RadToolBarButton runat="server" Value="C" Text="Button 2">  

    Page_Load(object sender, System.EventArgs e)  

     Protected Sub Page_Load(ByVal sender As ObjectByVal e As System.EventArgs) Handles Me.Load  
        End Sub 

    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Back to Top