title: ASP.NET GridView Button Event
body: <p>I'm trying to trigger a button event in a gridview. I created a gridview with the following code:</p>
  
  <pre><code>&lt;asp:GridView id="ItemsGrid2" BorderColor="black" CellPadding="3" 
                  BorderWidth="1" HeaderStyle-BackColor="DarkSlateGray" HeaderStyle-ForeColor="White"
              AutoGenerateColumns="false" AllowSorting="true" OnSortCommand="Sort_Grid" 
                  runat="server" align="center" Font-Name="Verdana" Font-Size="8"&gt;
                  &lt;Columns&gt;
                  &lt;asp:BoundField DataField="Title" HeaderText="Title"/&gt;
                  &lt;asp:BoundField DataField="Year" HeaderText="Year" /&gt;
                  &lt;asp:BoundField DataField="Score" HeaderText="Score" /&gt;
                  &lt;asp:BoundField DataField="Genre" HeaderText="Genre" /&gt;
                  &lt;asp:HyperLinkField HeaderText="Link" DataTextField="Link" DataNavigateUrlFields="Link"/&gt;
                  &lt;asp:TemplateField HeaderText="Seen"&gt;
                      &lt;ItemTemplate&gt;
                          &lt;asp:Button runat="server" Text="Seen" OnClick="Save_Check"/&gt;
                      &lt;/ItemTemplate&gt;
                  &lt;/asp:TemplateField&gt;
                  &lt;/Columns&gt;
              &lt;/asp:GridView&gt;
  </code></pre>
  
  <p>I bind the data with a dataset, this all works fine.
  But now I'm trying to trigger the Save_Check event which simply looks like:</p>
  
  <pre><code>public void Save_Check(object sender, EventArgs e)
          {
             string test = "test"; 
          }
  </code></pre>
  
  <p>However I always get an error: "Server error in application, wrong argument on repost". (It's in dutch so I tried to translate it as clearly as possible).</p>
  
  <p>Any ideas? I'm no expert in asp.net. I normally only code in c# or webservices, and sometimes silverlight. But this time I wanted to do it with asp.net.</p>