protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { //to get data from database List <Hotel> hotels = HotelDB.getHotelByCountry(Session["countryName"].ToString(), verification); //check the data is not null if (hotels.Count != 0) { Session["hotel"] = hotels; //create hotel session lblNoAcm.Visible = false; lvHotel.DataSource = hotels; lvHotel.DataBind(); } else { lblNoAcm.Visible = true; //show the error message } } lblCountry.Text = Session["countryName"].ToString(); //show the country name }