int userID = 1;//用户ID整个会话都要保存,默认没有登录,即为-1 protected void Page_Load(object sender, EventArgs e) { cinemaName = Convert.ToString(Session["CinemaNameToCinemaDetails"]); Session["CinemaNameToMovieList"] = cinemaName; //******************************************************************************* //注意,一定要将这两个量写在if判断的外面,否则每次点击按钮后变16-17行设置的默认值 //cinemaName=Session["CinemaName"]; //userID=Session["UserID"]; //******************************************************************************* if (!IsPostBack) { LabelCinemaName.Text = cinemaName; //根据电影院名得到电影院对象,从而获取电影院详细信息 CINEMA cinema = cinemaBll.GetCinema(cinemaName); LabelRank.Text = cinema.rank.ToString() + "分"; LabelRankNum.Text = "已有" + cinema.rank_number.ToString() + "人打分"; //绑定电影院图片到控件 string cinemaPicture = string.Empty; cinemaPicture = cinemaBll.GetCinemaPicture(cinemaName); ImageCinemaDetail.ImageUrl = cinemaPicture; LabelCinemaDetails.Text = cinema.introduction; //根据电影院名得到电影院最新评论列表,默认显示最新列表 List <Comment> comment = cinemaBll.GetLatestComment(cinemaName); DisplayCinemaComment(comment); } }
protected void Page_Load(object sender, EventArgs e) { cinemaName = (string )Session["CinemaName"]; userID = (int)Session["UserID"]; if (!IsPostBack) { LabelCinemaName.Text = cinemaName; //根据电影院名得到电影院对象,从而获取电影院详细信息 CINEMA cinema = cinemaBll.GetCinema(cinemaName); LabelRank.Text = cinema.rank.ToString() + "分"; LabelRankNum.Text = "已有" + cinema.rank_number.ToString() + "人打分"; //绑定电影院图片到控件 string cinemaPicture = string.Empty; cinemaPicture = cinemaBll.GetCinemaPicture(cinemaName); ImageCinemaDetail.ImageUrl = cinemaPicture; LabelCinemaDetails.Text = cinema.introduction; } }