title: Gridview attributes from code behind
body: <p>How can I set the OnRowDataBound method name from code behind?</p>
  
  <p>Aspx code:</p>
  
  <pre><code>OnRowDataBound = "gvResults_RowDataBound"
  </code></pre>
  
  <p>How to set that from code behind?</p>
  
  <pre><code>gvResults.Attributes["OnRowDataBound"] = "gvResults_RowDataBound";
  </code></pre>
  
  <p>does not work.</p>