我的页面上有一个asp下拉列表控件,带有一个设备列表。我试图获取所选值并将其传递给存储过程以将数据重新加载到我的图表中。但我无法弄清楚为什么它没有开火。我在所选索引更改方法的开头设置了一个断点但它永远不会到达那里。我在列表中选择和项目但没有任何反应。我已经测试了存储过程,没关系。
protected void Page_Load(object sender, EventArgs e)
{
}
protected void DeviceDropDownList_SelectedIndexChanged(object sender, EventArgs e)
{
SqlConnection sqlConn = new SqlConnection(WebConfigurationManager.ConnectionStrings["DefaultConnection"].ConnectionString);
SqlCommand command = new SqlCommand("RunningProcessCpuAndMemByHour", sqlConn);
sqlConn.Open();
command.CommandType = CommandType.StoredProcedure;
command.Parameters.Add(new SqlParameter("@Device", DeviceDropDownList.SelectedValue));
command.ExecuteNonQuery();
CpuAndMemoryByHourGraph.Series[0].YValueMembers = "cpu";
CpuAndMemoryByHourGraph.Series[1].YValueMembers = "mem_percent";
CpuAndMemoryByHourGraph.Series[0].XValueMember = "process";
CpuAndMemoryByHourGraph.DataSource = command.ExecuteReader();
CpuAndMemoryByHourGraph.DataBind();
sqlConn.Close();
}
谢谢!