title: How to use <%=control.ClientID%> in server control with embedded JS file
body: <p>I am creating a server control in a library project, which has javascript code, the javascript code need to get a button's ID, so I used &lt;%= button.ClientID %>. Then I embed the javascript code as a file in the library project and use ScriptManager to add the script in CreateChildControls(). </p>
  
  <pre><code>Dim sm = ScriptManager.GetCurrent(Me.Page) 
  sm.Scripts.Add(New ScriptReference("xxx.js", "LibraryProjectName"))   
  </code></pre>
  
  <p>But when I run the page, it has a jquery parse error:invalid expression term '>'. So I am guessing the code has been generated but server doesn't convert &lt;%= button.ClientID %> into generated ID format. So what should I do in this case? </p>