protected void ddlGenre_SelectedIndexChanged(object sender, EventArgs e)
        {
            Int32             genreId       = ddlGenre.SelectedIndex;
            clsDataConnection DB            = new clsDataConnection();
            clsDynamicPanel   aDynamicPanel = new clsDynamicPanel();

            string searchText = Session["searchText"].ToString();

            DB.AddParameter("@Title", searchText);
            DB.AddParameter("@GenreId", genreId);
            DB.Execute("sproc_tblFilm_CollateWithTblFilmGenreAndLinks");
            Int32 recordCount = DB.Count;
            Int32 index       = 0;

            if (recordCount != 0)
            {
                pnlActualSearchResults.Controls.Clear();
                while (index < recordCount)
                {
                    string title  = DB.DataTable.Rows[index]["Title"].ToString();
                    string imdbId = DB.DataTable.Rows[index]["ImdbId"].ToString();

                    pnlActualSearchResults.Controls.Add(aDynamicPanel.GenerateSearchResultsPanel(title, imdbId));
                    index++;
                }
            }
            else
            {
                pnlActualSearchResults.Controls.Clear();
                pnlActualSearchResults.Controls.Add(aDynamicPanel.GenerateEmptySearchResultsPanel());
            }
            pnlAllSearchResults.Visible = true;
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            pnlAllSearchResults.Visible = false;
            pnlError.Visible            = false;

            if (!IsPostBack)
            {
                try
                {
                    string searchText = Request.QueryString["searchText"];
                    Session["searchText"] = searchText;
                    CheckIfUserIsLoggedIn();

                    clsFilmCollection AllFilms      = new clsFilmCollection();
                    clsDataConnection DB            = new clsDataConnection();
                    clsDynamicPanel   aDynamicPanel = new clsDynamicPanel();

                    if (AllFilms.SearchForFilm(searchText).Count != 0)
                    {
                        foreach (clsFilm aFilm in AllFilms.SearchForFilm(searchText))
                        {
                            DB = new clsDataConnection();
                            DB.AddParameter("@FilmId", aFilm.FilmId);
                            DB.Execute("sproc_tblLinksFilterByFilmId");

                            string imdbId = DB.DataTable.Rows[0]["ImdbId"].ToString();
                            pnlActualSearchResults.Controls.Add(aDynamicPanel.GenerateSearchResultsPanel(aFilm.Title, imdbId));
                        }
                        GenerateMoods();
                        pnlAllSearchResults.Visible = true;
                    }
                    else
                    {
                        pnlActualSearchResults.Controls.Clear();
                        pnlActualSearchResults.Controls.Add(aDynamicPanel.GenerateEmptySearchResultsPanel());
                    }
                }
                catch
                {
                    pnlError.Visible = true;
                }
            }
        }