I have a FormView used to edit records but when the user presses the Button, it also needs to do some back-end stuff in the code-behind. For this I need to pass the ID of the record.
Currently this is my code in the page:
<asp:LinkButton ID="savebtn" runat="server" CausesValidation="True"
CommandName="Update" Text="Save Changes"
OnClick="setProcessProgress" CommandArgument='<%# Eval("id") %>' />
And this is a stripped-down version of my code-behind:
protected void setProcessProgress(object sender, FormViewCommandEventArgs e)
{
if (e.CommandName == "Update")
ID_p = Int32.Parse((string)e.CommandArgument);
}
I’m getting the No overload for 'setProcessProgress' matches delegate 'System.EventHandler'
I tried changing the EventArgs to CommandEventArgs and it didn’t work either.
If I use OnCommand instead of OnClick it just doesn’t call setProcessProgress. Any ideas?
According to the MSDN Documentation on
FormViewCommandEventArgs.The event is not assigned to the Button’s OnClick event, it is actually assigned to the
FormViewsItemCommandEventi.e