Background
I have the following code that is supposed to refresh data when a button called refresh is clicked.
public static void refreshBaan()
{
SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString);
SqlCommand comm = new SqlCommand("sp_start_job", conn);
SqlParameter jobname = new SqlParameter("job_name", "EBS");
SqlParameter servername = new SqlParameter("server_name", "bnvmsql0a610912");
comm.Parameters.Add(jobname);
comm.Parameters.Add(servername);
comm.CommandType = CommandType.StoredProcedure;
conn.Open();
comm.ExecuteReader();
conn.Close(); `
}
I have an Updatepanel that I want to show when clicked, so naturally I want to put in Updatpanel1.visible = true; in the above statement, but it doesn’t let me.
Question
How can I refresh the data using an updatepanel? Where do I need to instantiate that update panel?
You can only access instance members of a class in non-static methods.
I would suggest creating a click handler specifically for the button such as:
where the button declaration looks something like: