This is a universal method to find the RadPanelbar client object regardless where it is nested on the page. This method comes in handy if RadPanelbar is nested in another control:
 |
RadPanelbar must be rendered only once. For example, you can use this approach if RadPanelbar is nested in a toolbar template button. However, if RadPanelbar is nested in a grid with more than one row, the method fails since there will be multiple instances the rendered Panelbar for each grid row. |
| |
Copy Code |
|
<script type="text/javascript"> var panelbar1; function StorePanelbarClientObject(sender) { panelbar1 = sender; } function UtilizePanelbarClientObject() { alert(panelbar1.ID); } </script> <AnyControl> <Template> <rad:RadPanelbar ID="RadPanelbar1" OnClientLoad="StorePanelbarClientObject" runat="server"> </rad:RadPanelbar> </Template> </AnyControl> <input id="Button1" type="button" onclick="UtilizePanelbarClientObject()" value="button" /> |
The above approach is possible due to the OnClientLoad event of RadPanelbar.
 |
The StorePanelbarClientObject function must be declared before the RadPanelbar definition. |