I am trying to trigger a button event in gridview. I created a gridview with the following code:
<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"> <Columns> <asp:BoundField DataField="Title" HeaderText="Title"/> <asp:BoundField DataField="Year" HeaderText="Year" /> <asp:BoundField DataField="Score" HeaderText="Score" /> <asp:BoundField DataField="Genre" HeaderText="Genre" /> <asp:HyperLinkField HeaderText="Link" DataTextField="Link" DataNavigateUrlFields="Link"/> <asp:TemplateField HeaderText="Seen"> <ItemTemplate> <asp:Button runat="server" Text="Seen" OnClick="Save_Check"/> </ItemTemplate> </asp:TemplateField> </Columns> </asp:GridView>
I bind data to a dataset, it all works great. But now I'm trying to fire the Save_Check event, which looks simple:
public void Save_Check(object sender, EventArgs e) { string test = "test"; }
However, I always get the error "Server error in application, invalid argument when sending." (He is Dutch, so I tried to translate it as clearly as possible).
Any ideas? I am not an expert at asp.net. I usually only code in C # or webservices, and sometimes silverlight. But this time I wanted to do this using asp.net.
source share