Abdalla Elawad

Abdalla Elawad

  • NA
  • 1k
  • 216.6k

Script working as Keypress, Event in asp.net stop

Oct 4 2016 4:35 AM

how to use Keypress,KeyUp,KeyDown Event in asp.net

in last time i get a solution from here site for keypress events as script but now is stop

<script>
function getdata(e) {
if (e.keyCode == 13) {
SqlCommand cmd = new SqlCommand("Select * from TBL_PRD WHERE Barcode=@Barcode", Conn);
cmd.Parameters.Add(new SqlParameter("@BARCODE", TextBox3.Text));
Conn.Open();
SqlDataReader reader = cmd.ExecuteReader();
while (reader.Read())
{
TextBox3.Text = reader.GetString(1);
TextBox4.Text = reader.GetString(2);
DropDownList3.Text = reader.GetString(3);
//DropDownList2.Text = reader.GetString(4);

}
reader.Close();
Conn.Close();
//TextBox1.Text = "";
//TextBox2.Text = "";

}
e.preventDefault();
return false;
}
else if (e.keyCode == 9) {
SqlCommand cmd = new SqlCommand("Select * from TBL_PRD WHERE Barcode=@Barcode", Conn);
cmd.Parameters.Add(new SqlParameter("@BARCODE", TextBox3.Text));
Conn.Open();
SqlDataReader reader = cmd.ExecuteReader();
while (reader.Read())
{
TextBox3.Text = reader.GetString(1);
TextBox4.Text = reader.GetString(2);
DropDownList3.Text = reader.GetString(3);
//DropDownList2.Text = reader.GetString(4);

}
reader.Close();
Conn.Close();
//TextBox1.Text = "";
//TextBox2.Text = "";

}
e.preventDefault();
return false;
}
}
</script>

what is solution >>> ?
please help me  

Answers (1)