あなたの Button1_Click 関数は正しいです。オブジェクトから呼び出す方法が間違っていると思います。
どちらかを使用する必要があります
<asp:Button ID="btn_test" runat="server" OnClick="Button1_Click" Text="Button" />
protected void Button1_click(Object sender, EventArgs e)
{
int ID = 0;
Label5.Visible = false;
ID = Convert.ToInt32(GridView1.Rows[row.RowIndex].Cells[1].Text);
Response.Redirect("~/Producter/Delete?id="+ ID);
}
または、html ボタン オブジェクトを使用して、以下のような webmethod を呼び出す必要があります
<script>
$(document).ready(function () {
$('#test').click(function(){
$.ajax({
type: "POST",
url: "Profile.aspx/update_phone",
data: "{'ProfessionalID':''}",
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function () { }
});
});
});
</script>
<button id="test" runat="server"> Button here </button>
[webmethod]
public static void Button1_click(Object sender, EventArgs e)
{
....
Response.Redirect("~/Producter/Delete?id="+ ID);
}