title: Accessing a control in asp.net content page through Javascript
body: <p>I have a form in my content page for which I am doing some client side validations via Javascript. The Javascript behaves as expected if I place the JS code directly in the content page. But if I place the JS code in it's own file and try accessing that from the content/master page (through the script tag's src attribute), I get a run time error when the validation function in JS being called.</p>
  
  <p>To be specific, I get the below error.
  Microsoft JScript runtime error: Objected expected/required at this line - document.getElementById('&lt;%=txtemailId.ClientID %>').value</p>
  
  <p>txtemailId is in the content page.</p>
  
  <p>Javascript code is placed in validation.js and accessed via master page.</p>
  
  <p>The reason I guess is that when .net is parsing the files, it is unable to substitute txtemailId.ClientID with the client side value that would be generated later on. So, how should one go about it? Thanks!</p>