title: How do you set ASP.net html control(label) using javaScript
body: <p>I have created a JavaScript function to get the type of html control and set it to specified value.</p>
  
  <pre><code>function SetControlValue(ctrl, value) {
  
  if (value == undefined)
      return "";
  
  if (document.getElementById(ctrl).type == "text") {
      document.getElementById(ctrl).value = value;
  }
  
  
  else if (document.getElementById(ctrl).type == "label") {
  
     //document.getElementById(ctrl).innerText = value;
     document.getElementById(ctrl).innerHTML = value;      
  
  } 
  
  return false;
  
  }
  </code></pre>
  
  <p>On my ASPX page i have created a label as below  </p>
  
  <pre><code>&lt;asp:Label id="lblMessage" class="labels"Font-Size="Medium" runat="server"&gt;&lt;/asp:Label&gt;
  </code></pre>
  
  <p>and now calling the function  </p>
  
  <pre><code>var don="sample text";
  
  SetControlValue('lblMessage', don)
  </code></pre>
  
  <p>My question is why SetControlValue() function working on text fields but does not work on labels. Is there something that am missing?  Thanks.</p>