title: Get the clientID of nested panel control in masterpage using javascript
body: <p>This is the control structure</p>
  
  <p>ContentPlaceHolder <br />
  &nbsp;&nbsp;--> Wizard <br />
  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;--> Panel</p>
  
  <p>I am using setTimeout to display the panel after x minutes.</p>
  
  <p>How do I get the ClientID of the panel?</p>
  
  <p>The line of javascript needed is something like:</p>
  
  <pre><code>setTimeout(displayExtendSession('&lt;%= ExtendSession.ClientID  %&gt;', 600000);
  </code></pre>
  
  <p>aspx</p>
  
  <pre><code>&lt;asp:Content ID="Content1" runat="server" ...&gt;
      &lt;asp:Wizard ID="wizard1" runat="server" ... &gt;
          &lt;asp:Panel ID="ExtendSession" runat="server"&gt;
              &lt;asp:Label ID="ExtendSessionLifePrompt" runat="server" Text="Your session is going to expire in 1 minute. Would you like to extend your Session?"&gt;&lt;/asp:Label&gt;
              &lt;asp:Button ID="ExtendSessionLife" runat="server" Text="Yes" /&gt;
              &lt;input type="button" id="CancelExtendSessionLife" value="No" onclick="HideExtendSession('&lt;%= ExtendSession.ClientID %&gt;'); return false;" /&gt;  
          &lt;/asp:Panel&gt;
      &lt;/asp:Wizard&gt;
  &lt;/asp:Content&gt;
  </code></pre>
  
  <p>javascript</p>
  
  <pre><code>function HideExtendSession(msgBox) {
      if (msgBox)
          document.getElementById(msgBox).style.display = "none";
  }
  function DisplayExtendSession(msgBox) {
      if (msgBox) 
          document.getElementById(msgBox).style.display = "block";
  }
  
  setTimeout(DisplayExtendSession('&lt;%= ExtendSession.ClientID  %&gt;', 600000);
  setTimeout(HideExtendSession('&lt;%= ExtendSession.ClientID %&gt;', 720000);
  </code></pre>