title: How to get clientID of Datalist control using jquery
body: <p>How to get clientID of Datalist control using jquery , I tried using the code below with no succes:</p>
  
  <pre><code>$(document).ready(function(){
  $('#&lt;%=txtRenewalDate.ClientID %&gt;').datepicker();
      $('#&lt;%=txtCallBackDate.ClientID %&gt;').datepicker();
  
  });
  &lt;asp:DataList ID="dlCustomers" runat="server" ClientIDMode="Predictable"&gt;
      &lt;ItemTemplate&gt;
        &lt;table border="0"&gt;
                      &lt;tr&gt;
                          &lt;td class=""&gt;
                              RenewalDate:
                          &lt;/td&gt;
                          &lt;td class=""&gt;
                              &lt;asp:TextBox ID="txtRenewalDate" runat="server" Text='&lt;%# Eval("RenewalDate") %&gt;' ClientIDMode="Static"&gt;&lt;/asp:TextBox&gt;
                          &lt;/td&gt;
                      &lt;/tr&gt;
                      &lt;tr&gt;
                          &lt;td class=""&gt;
                              Callback
                          &lt;/td&gt;
                          &lt;td class=""&gt;
                              &lt;asp:TextBox ID="txtCallBackDate" runat="server" Text='&lt;%# Eval("Callback") %&gt;' ClientIDMode="Static"&gt;&lt;/asp:TextBox&gt;
                          &lt;/td&gt;
                      &lt;/tr&gt;&lt;/table&gt;
                       &lt;/ItemTemplate&gt;
  &lt;/asp:DataList&gt;
  </code></pre>
  
  <p>Markup when script is commented
      </p>
  
  <pre><code>                        &lt;td class=""&gt;
  
                              RenewalDate:
  
                          &lt;/td&gt;
  
                          &lt;td class=""&gt;
  
                              &lt;input name="ctl00$MainContent$dlCustomers$ctl00$txtRenewalDate" type="text" value="27/01/2012 00:00:00" id="txtRenewalDate" /&gt;
  
                          &lt;/td&gt;
  
                      &lt;/tr&gt;
  
                      &lt;tr&gt;
  
                          &lt;td class=""&gt;
  
                              Callback
  
                          &lt;/td&gt;
  
                          &lt;td class=""&gt;
  
                              &lt;input name="ctl00$MainContent$dlCustomers$ctl00$txtCallBackDate" type="text" value="27/01/2012 00:00:00" id="txtCallBackDate" /&gt;
  
                          &lt;/td&gt;
  
                      &lt;/tr&gt;
  </code></pre>
  
  <p>I get the following errors when i run :
  The name 'txtRenewalDate' does not exist in the current context 
  The name 'txtCallBackDate' does not exist in the current context    </p>
  
  <p>Any ideas where i am getting it wrong .</p>
  
  <p>Thanks</p>