title: How do I set a value to the Session in asp.net on an onClick event of a normal htmlElement?
body: <p>I need to make a Function that receives a Session Key and a Session Value and call this function on a normal HTML onClick event. When this function is called the Session variable is assigned the Key I sent with the Value I sent. So far I have this:</p>
  
  <pre><code>&lt;script runat="server" type="text/C#"&gt;
          protected void setSessionValue(string key, string value)
          {
              Session[key] = value;
          }  
  &lt;/script&gt;
  </code></pre>
  
  <p>But when I try to call if like so:</p>
  
  <pre><code>onclick="setSessionValue('itemID','3345');"
  </code></pre>
  
  <p>Its not working and giving me an error. Any help? I'm using c# and asp.net but I can't use code behind and need to work everything off the page.</p>