Telerik RadPanelBar provides a flexible client-side API. You can easily interact with the panelbar in the browser using the panelbar client-side object.
1. Getting the RadPanelBar client-side object
RadPanelBar creates a client-side object with the ClientID of the panelbar. You can obtain the reference using the following JavaScript code:
| |
Copy Code |
|
var panelbar = <%= RadPanelBar1.ClientID %>; |
2. Getting the instance of a particular RadPanelItem
Once you get the client-side object of RadPanelBar, you can use the FindItemByText() method to get the instance of a particular item. Example:
| |
Copy Code |
|
var panelbar = <%= RadPanelBar1.ClientID %>; var item = panelbar.FindItemByText(text); |
3. Calling a client-side method
When you get the instance of a particular item, you can call a client-side method to perform a task. Consider the following examples:
-
Expand()
| |
Copy Code |
|
function ExpandItem() { var panelbar = <%= RadPanelBar1.ClientID %>; var item = panelbar.FindItemByText(text); if (item) { item.Expand(); } else { alert("Item with text '" + text + "' not found."); } } |
-
Collapse()
| |
Copy Code |
|
function CollapseItem() { var panelbar = <%= RadPanelBar1.ClientID %>; var item = panelbar.FindItemByText(text); if (item) { item. Collapse(); } else { alert( "Item with text '" + text + "' not found."); } } |
-
Disable()
| |
Copy Code |
|
function DisableItem() { var panelbar = <%= RadPanelBar1.ClientID %>; var item = panelbar.FindItemByText(text); if (item) { item.Disable(); } else { alert( "Item with text '" + text + "' not found."); } } |
-
Enable()
| |
Copy Code |
|
function EnableAll() { var panelbar = <%= RadPanelBar1.ClientID %>; for (var i = 0; i < panelbar.AllItems.length; i++) { panelbar.AllItems[i].Enable(); } } |
 |
The code block <%= ... %> needs to be placed inside the BODY element of the page. See Atlas support for details. |
See Also