protected void Page_Load(object sender, EventArgs e) { UnobtrusiveValidationMode = UnobtrusiveValidationMode.None; if (Session["adminname"] == null) { Response.Redirect("adminLogin.aspx"); } if (!IsPostBack) { if (Request.QueryString["SingerID"] != null) { int id = int.Parse(Request.QueryString["SingerID"]); DataTable dt = SingerManager.selectID(id); ViewState["object"] = singer;//使用视图 ViewState 因为大量的session会增加服务器负担 将需要的保存在视图中 txtSingerid.Text = Convert.ToString(dt.Rows[0]["SingerID"]); txtSingername.Text = Convert.ToString(dt.Rows[0]["SingerName"]); txtType.Text = Convert.ToString(dt.Rows[0]["SingerType"]); txtSiContent.Text = Convert.ToString(dt.Rows[0]["SingerInfo"]); sinImage.ImageUrl = ResolveUrl(dt.Rows[0]["SingerImg"].ToString()); } } }
protected void Page_Load(object sender, EventArgs e) { int singerID; if (Request.QueryString["ID"] != null) { singerID = Convert.ToInt32(Request.QueryString["ID"].ToString()); DataTable dt = SingerManager.selectID(singerID); if (dt != null && dt.Rows.Count != 0) { lblSinName.Text = dt.Rows[0][1].ToString(); lblSinType.Text = dt.Rows[0][2].ToString(); txtinfo.Text = dt.Rows[0][3].ToString(); imgSin.ImageUrl = ResolveUrl(dt.Rows[0][4].ToString()); lblSinHits.Text = (Convert.ToUInt32(dt.Rows[0][5]) + SingerManager.updateClickNum(singerID)).ToString(); } } BindSinger(); BindSong(); }