protected void GridCart_RowCommand(object sender, GridViewCommandEventArgs e)
{
if (e.CommandName == "Delete")
{
int index = Convert.ToInt32(e.CommandArgument);
int hdnimageid = Convert.ToInt32(((HiddenField)GridCart.Rows[index].Cells[0].FindControl("hdnimageid")).Value);
con.Open();
SqlCommand cmd = new SqlCommand("Delete from temporder where pid='" + hdnimageid + "'", con);
cmd.ExecuteNonQuery();
con.Close();
loadgridnew();
}
}
public void loadgridnew()
{
DataTable dt = new DataTable();
SqlCommand cmd = new SqlCommand("select * from temporder where ipaddress='" + ipAddress + "'", con);
SqlDataAdapter da = new SqlDataAdapter(cmd);
da.Fill(dt);
GridCart.DataSource = dt;
GridCart.DataBind();
}what is the problem in it why page is not refreshing??????
<asp:ButtonField Text="Delete" CommandName="Delete" />