title: ASP.net C# Gridview ButtonField onclick event
body: <p>I've written an ASP code for a webshop type project. There is a method that adds the ProductID to a cookie and adds 1 to the quantity of the product. 
  Another method reads the cookie, transforms the cookie to a data table and puts it in a gridview. This gridview basically is the shoppingcart.aspx page. </p>
  
  <p>What i now need is a way to add a buttonfield to that gridview where i can add a ++ button (like the add to shopping cart button on a product page), normal asp buttons take a <code>onclick="methodname"</code> but these in the gridview don't.</p>
  
  <pre><code>add1ToShoppingCart(string productId)
  {[...]shoppingCartCookie[productId] = (amount + 1).ToString();}
  </code></pre>
  
  <p>That is the code I use for all the ++ buttons. It takes the button.id (buttonID=productID). So I need a way to have all the buttons be the same image, but the buttonID has to be databound to the productID so it can somehow execute that method (with some sort of <code>onclick=""</code>).</p>
  
  <p>I've looked and googled for the past couple hours but I cant seem to find anything. In the past I found a lot of answers on stackoverflow so I hoped somebody here could help.</p>
  
  <p>Thanks in advance.</p>