下面是一个asp按钮,我需要在页面后面的代码上运行C#命令。C#Onclick命令不起作用
<asp:ImageButton ID="Retire" OnClick="this.retire" ImageUrl="/assets/images/ast/delete_32x32.png" AlternateText="~retire" ToolTip="Retire" runat="server" />
背后
public void retire(object sender, EventArgs e)
{
using (SqlConnection connection = new SqlConnection(WebConfigurationManager.ConnectionStrings["app_migrationConnectionString"].ConnectionString))
{
connection.Open();
using (SqlCommand cmd = new SqlCommand("UPDATE Apps SET Migration_Phase = '-1' WHERE ID = @ID", connection))
{
cmd.Parameters.AddWithValue("@ID", float.Parse(Request.QueryString["ID"]));
}
connection.Close();
Page.Response.Redirect(Page.Request.Url.ToString(), false);
}
}
我的C#代码我需要一个不同的OnClick还是我失去了一些东西?
为什么你把 “this.retire” 中的onclick?这只是“退休”。 – Srinivas