Access control inside UserControl (ASCX) from Parent Page (ASPX) using JavaScript

1 posts, 0 answers
  1. Patrick
    Patrick avatar
    1 posts
    Member since:
    Nov 2014

    Posted 24 Apr 2015 Link to this post

    I have a ragrid in a aspx page , from this grid by clicking on a row I open a radtooltipmanager that contains a usercontrol . On opening this user control I want to Maintain Scrollbar panel Position.
    I tried to folow this exemples :

    http://www.codeproject.com/Tips/595712/Call-JavaScript-in-an-ASP-NET-User-Control

    https://basgun.wordpress.com/2008/06/09/maintain-scroll-position-updatepanel-postback/

     http://www.aspsnippets.com/Articles/Find-and-access-control-inside-UserControl-ASCX-from-Parent-Page-ASPX-using-JavaScript-in-ASPNet.aspx

    But the problem is that the  panel.scrollHeight return 0, I attached ths screenshot for page and this a part of my code :

    <body>
        <form id="form1" runat="server">
            <uc1:Name runat="server" ID="ucConusltationLieesCtl" />
            <asp:ScriptManager runat="server" ID="ScriptManager1">
                  </asp:ScriptManager>
              <script type="text/javascript">
                  Sys.WebForms.PageRequestManager.getInstance().add_beginRequest(ToCallOnBeginRequest);
                  function ToCallOnEndRequest(sender, args) {
                      var panel = document.getElementById('<%=ucConusltationLieesCtl.FindControl("Consul_Panel2").ClientID %>');

                      if (panel) {
                        panel.scrollTop = panel.scrollHeight;
                     }
                     document.documentElement.scrollTop = yPos;

                  }
                  function ToCallOnBeginRequest(sender, args) {
                       yPos = document.documentElement.scrollTop;
                   }
                   Sys.WebForms.PageRequestManager.getInstance().add_endRequest(ToCallOnEndRequest);
              </script>

     

    Thanks

Back to Top