protected void searchByNameBtn_Click(object sender, EventArgs e) { int userID; taDetailsList.Items.Clear(); namesDropList.SelectedIndex = 0; try { db_connection db_obj = new db_connection(); db_obj.open(); string query = "SELECT user_id FROM user WHERE user_tp = @tp"; MySqlCommand cmd = new MySqlCommand(query, db_obj.connection); cmd.Parameters.AddWithValue("@tp", tpToFind.Text); userID = int.Parse(cmd.ExecuteScalar().ToString()); db_obj.close(); human_resource newHR = new human_resource(); populateTAdetails(newHR.viewTAdetails(userID)); } catch (Exception ex) { msg.Text = "User Could not be found!"; } }
protected void namesDropList_SelectedIndexChanged(object sender, EventArgs e) { if (namesDropList.SelectedIndex != 0) { tpToFind.Text = ""; taDetailsList.Items.Clear(); human_resource newHR = new human_resource(); populateTAdetails(newHR.viewTAdetails(int.Parse(namesDropList.SelectedValue))); } }