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

Get/Set value to ItemTemplate object in RadToolbar

2 Answers 187 Views
ToolBar
This is a migrated thread and some comments may be shown as answers.
Hansik
Top achievements
Rank 1
Hansik asked on 24 Feb 2010, 07:06 PM
Hi,

   I created a Textbox object as an ItemTemplate for a RadToolBarButton item on my RadToolBar.

   I just need to get its value and also set a new value both on the client side. I found some codes/suggestions here in the forum that access these values, but I think they are all done on the server side. 

  I really appreciate your help!

Thanks,
Arthur

2 Answers, 1 is accepted

Sort by
0
Accepted
Yana
Telerik team
answered on 25 Feb 2010, 02:04 PM
Hello Arthur,

If your RadToolBarButton is something like this:

<telerik:RadToolBarButton Text="button1">
    <ItemTemplate>
        <asp:TextBox ID="textBox1" runat="server" />
    </ItemTemplate>
</telerik:RadToolBarButton>

you can get the textbox with the following code:

function getTextBox() {
    var toolbar = $find("<%=toolbar1.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";
}


Best regards,
Yana
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
Hansik
Top achievements
Rank 1
answered on 02 Mar 2010, 06:24 PM
Thanks, Yana for the suggestion. It works now!!! I really appreciate it!
Tags
ToolBar
Asked by
Hansik
Top achievements
Rank 1
Answers by
Yana
Telerik team
Hansik
Top achievements
Rank 1
Share this question
or