This is a migrated thread and some comments may be shown as answers.

RadToolBar OnClientButtonClicked And ItemTemplate

1 Answer 89 Views
ToolBar
This is a migrated thread and some comments may be shown as answers.
Ali
Top achievements
Rank 1
Ali asked on 22 Sep 2011, 03:41 PM
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

1 Answer, 1 is accepted

Sort by
0
Kate
Telerik team
answered on 23 Sep 2011, 08:51 AM
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
Tags
ToolBar
Asked by
Ali
Top achievements
Rank 1
Answers by
Kate
Telerik team
Share this question
or