protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { //Load the DropDown //ds = obj.LoadMovieList(); //ddlMovieList.DataSource = ds.Tables[0]; //ddlMovieList.DataTextField = ConfigurationManager.AppSettings["ColumnName"]; //ddlMovieList.DataValueField = ConfigurationManager.AppSettings["ColumnName"]; //ddlMovieList.DataBind(); //ListItem item = new ListItem("-Select a movie-", "0"); //ddlMovieList.Items.Insert(0, item); //Retrieve the Upcoming movies try { RottenTomato rt = new RottenTomato(); List <string> recentMovies = rt.FindMoviesInTheaterList(); List <string> upcomingMovies = rt.FindOpeningMoviesList(); for (int i = 0; i < 5; i++) { LinkButton lnk = (LinkButton)FindControl("lnkBtnUpcomingMovie" + (i + 1).ToString()); lnk.Text = upcomingMovies[i]; lnk = (LinkButton)FindControl("lnkBtnRecentMovie" + (i + 1).ToString()); lnk.Text = recentMovies[i]; } } catch (Exception ex) { } } //list of movies for (int i = 65; i <= 90; i++) { LinkButton link = new LinkButton(); link.Text = " " + ((char)i).ToString() + " "; link.ToolTip = "Get the list of movies starting with the letter " + link.Text; link.Click += new System.EventHandler(link_Click); pnlList.Controls.Add(link); } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { //Load the DropDown //ds = obj.LoadMovieList(); //ddlMovieList.DataSource = ds.Tables[0]; //ddlMovieList.DataTextField = ConfigurationManager.AppSettings["ColumnName"]; //ddlMovieList.DataValueField = ConfigurationManager.AppSettings["ColumnName"]; //ddlMovieList.DataBind(); //ListItem item = new ListItem("-Select a movie-", "0"); //ddlMovieList.Items.Insert(0, item); //Retrieve the Upcoming movies try { RottenTomato rt = new RottenTomato(); List<string> recentMovies = rt.FindMoviesInTheaterList(); List<string> upcomingMovies = rt.FindOpeningMoviesList(); for (int i = 0; i < 5; i++) { LinkButton lnk = (LinkButton)FindControl("lnkBtnUpcomingMovie" + (i + 1).ToString()); lnk.Text = upcomingMovies[i]; lnk = (LinkButton)FindControl("lnkBtnRecentMovie" + (i + 1).ToString()); lnk.Text = recentMovies[i]; } } catch (Exception ex) { } } //list of movies for (int i = 65; i <= 90; i++) { LinkButton link = new LinkButton(); link.Text = " " + ((char)i).ToString() + " "; link.ToolTip = "Get the list of movies starting with the letter " + link.Text; link.Click += new System.EventHandler(link_Click); pnlList.Controls.Add(link); } }