我需要将文本框中的输入作为数值。我需要从输入的文本框和从数据库值中检索的数据做产品。如何在文本框上进行按键事件?
SqlConnection objcon = new SqlConnection(conn);
objcon.Open();
string SQL = "select * from Price";
SqlCommand objCommand = new SqlCommand(SQL, objcon);
SqlDataAdapter adapter = new SqlDataAdapter();
DataSet DS = new DataSet();
adapter.SelectCommand = objCommand;
adapter.Fill(DS);
DataTable dt = DS.Tables[0];
DataView dvWindows = new DataView(dt);
dvWindows.RowFilter = "Description = 'Windows'";
foreach (DataRowView rowView in dvWindows)
{
DataRow row = rowView.Row;
decimal d =Convert.ToInt32(txtncores.Text) * (decimal)row["CoreCost"];// txtncores is textbox
txtWindows.Text = d.ToString();// result value to populate in text box
}
帮帮我,我是否需要在同一页面上的部分更新上使用 Ajax 而不会闪烁