RadToolBar OnClientButtonClicked And ItemTemplate

2 posts, 0 answers
  1. Ali
    Ali avatar
    2 posts
    Member since:
    Sep 2011

    Posted 22 Sep 2011 Link to this post

    Hi,
    My Problem is --> can't access to RadToolBar Item Template When Using OnClientButtonClicked

    function getTextBox() {          
    var
    toolbar = $find("<%=RadToolBar1.ClientID %>");
         
    var button = toolbar.findItemByText("button1");
         
    var textBox = button.get_element().firstChild;
         
    if (textBox.type != "text")
          textBox = textBox.nextSibling;
          alert(textBox.value);
          textBox.value =
    "test";
       }

    ----------------------
    <telerik:RadToolBar ID="RadToolBar1" Runat="server" dir="rtl"
                    EnableEmbeddedSkins="False" Skin="Outlook" Width="100%" OnClientButtonClicked="click_handler">
            <Items>
    <telerik:RadToolBarButton Text="button1">
        <ItemTemplate>
            <asp:TextBox ID="textBox1" runat="server" />
        </ItemTemplate>
    </telerik:RadToolBarButton>
    .
    .
    .

    ----------------------

    When I delete OnClientButtonClicked="click_handler" it's work fine but i need handle button click and textbox value

    sorry for bad english

  2. Kate
    Admin
    Kate avatar
    1898 posts

    Posted 23 Sep 2011 Link to this post

    Hi Ali,

    Using the following code snippet you can find the TextBox that is placed in the ItemTemplate of a RadToolBar:
    <script type="text/javascript">
            function click_handler(sender, args) {
                alert($telerik.$("#[id*='textBox1']").attr('id'));
            }
         
        </script>


    Kind regards,
    Kate
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top