protected void Page_Load(object sender, EventArgs e) { WelcomeMessage.Text = "Hello, " + Session["FullName"]; if (IsPostBack.Equals(false)) { } if (IsPostBack.Equals(false)) { cn.Open(); String com = "SELECT [Email] FROM [dbo].[Users] WHERE [UserRole] = 'Admin';"; SqlCommand sqlCommand = new SqlCommand(com, cn); SqlDataReader selectEmployeesDA = sqlCommand.ExecuteReader(); if (selectEmployeesDA.HasRows) { while (selectEmployeesDA.Read()) { emailDropDown.Items.Add(new ListItem((selectEmployeesDA.GetString(0)))); } } cn.Close(); } if (IsPostBack.Equals(false)) { cn.Open(); String com = "SELECT [Email] FROM [dbo].[Users] WHERE [UserRole] = 'Renter' AND [Verified] = 'Unverified' OR [UserRole] = 'Host' AND [Verified] = 'Unverified';"; SqlCommand sqlCommand = new SqlCommand(com, cn); SqlDataReader selectEmployeesDA = sqlCommand.ExecuteReader(); if (selectEmployeesDA.HasRows) { while (selectEmployeesDA.Read()) { UnverifiedDropDown.Items.Add(new ListItem((selectEmployeesDA.GetString(0)))); } } selectEmployeesDA.Close(); // fill UserDropDown string AllUsers = "Select Email from Users where UserRole='Host' or UserRole='Renter' and AccountStatus='Actived'"; SqlCommand command = new SqlCommand(AllUsers, cn); SqlDataReader reader = command.ExecuteReader(); if (reader.HasRows) { while (reader.Read()) { UserDropDown.Items.Add(new ListItem((reader.GetString(0)))); } } reader.Close(); // fill deactived userdropdown string DeactivedUser = "******"; SqlCommand sql = new SqlCommand(DeactivedUser, cn); SqlDataReader reader2 = sql.ExecuteReader(); if (reader2.HasRows) { while (reader2.Read()) { DeavtivedUserDropDownList.Items.Add(new ListItem((reader2.GetString(0)))); } } else { DeactivedLbl.Visible = true; } reader2.Close(); cn.Close(); } if (Session["SignInEmail"] == null) { //ScriptManager.RegisterStartupScript(this, this.GetType(), "Pop", "openLoginModal();", true); } else { var master = Master as RoomMagnet; master.AfterLogin(); } //SqlConnection db = new SqlConnection(ConfigurationManager.ConnectionStrings["MyConnectionString"].ToString()); //db.Open(); //SqlCommand selectuser = new SqlCommand(); //selectuser.Connection = db; //int userid = Convert.ToInt32(Session["UserID"]); //selectuser.CommandText = "select [FirstName], [Gender], [Occupation], [Description], [DateOfBirth] from [RoomMagnet].[dbo].[Users] where [UserID] =@UserID"; //selectuser.Parameters.Add(new SqlParameter("@UserID", userid)); //SqlDataReader getinfor = selectuser.ExecuteReader(); }