Link to home
Start Free TrialLog in
Avatar of AU_IT
AU_ITFlag for Afghanistan

asked on

Javascript in ascx page not passing variable correctly using telerik:radmultipage (VB)

I have a telerik:radmultipage and on one of the tabs I have the following (shortened for space):

<asp:LinkButton ID="LinkButton1" runat="server" OnClientClick="expandAllCollapsiblePanels()"
        CssClass="expand">Expand All</asp:LinkButton>

Open in new window


That calls :

<telerik:RadScriptManager>
<asp:PlaceHolder ID="PlaceHolder1" runat="server">
    <script type="text/javascript">

        function collapseAllCollapsiblePanels() {
            var panelBar = $find("<%= rpbCAS.ClientID %>");
            var panelBar2 = $find("<%= rpbCCS.ClientID %>");
          
            var items = panelBar.get_items();
            for (var i = 0; i < items.get_count(); i++) {
                var item = items.getItem(i);
                if (item) {
                    item.collapse();
                }
            }

            var items2 = panelBar2.get_items();
            for (var i = 0; i < items2.get_count(); i++) {
                var item2 = items2.getItem(i);
                if (item2) {
                    item2.collapse();
                }
            }

 }

        function OnClientLoadHandler(sender, eventArgs) {
            for (var i = 0; i < sender.get_items().get_count(); i++) {
                sender.get_items().getItem(i).set_expanded(true);
            }
        }

Open in new window



When I load this ascx page as the starting tab, the script runs perfect. If I make this tab 2, it no longer works. Firebug says: Sys.WebForms.PageRequestManagerServerErrorException: D:\serverlocation\Major.ascx(9): error BC30451: 'MajoruserControl_rpbCAS' is not declared. It may be inaccessible due to its protection level.

I read that ascx pages will rename controls/variables/values, but if I try to manually bind my js as so:

var panelBar = $find("<%=MajoruserControl_rpbCAS.ClientID %>");

Open in new window


It doesn't load the page at all.

Can someone point me in the correct direction please? Thanks in advance!
Jason
ASKER CERTIFIED SOLUTION
Avatar of AU_IT
AU_IT
Flag of Afghanistan image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of AU_IT

ASKER

(Removed comment for duplication and added content to previous response)