protected void Page_Load(object sender, EventArgs e) { CommFun.IsAdmin(); string strqry; if (!IsPostBack) { //服务器路径 strqry = "select * From T_Path"; DwPath.DataSource = DBFun.GetDataView(strqry).Table; DwPath.DataTextField = "Caption"; DwPath.DataValueField = "id"; DwPath.DataBind(); //类型 strqry = "select * From T_Class"; DwClass.DataSource = DBFun.GetDataView(strqry); DwClass.DataTextField = "caption"; DwClass.DataValueField = "ID"; DwClass.DataBind(); } }
protected void Page_Load(object sender, EventArgs e) { //网页加载 CommFun.IsAdmin(); string strqry; if (!IsPostBack) { //服务器路径 strqry = "select * From T_Path"; DwPath.DataSource = DBFun.GetDataView(strqry).Table; DwPath.DataTextField = "Caption"; DwPath.DataValueField = "id"; DwPath.DataBind(); //类型 strqry = "select * From T_Class"; DwClass.DataSource = DBFun.GetDataView(strqry); DwClass.DataTextField = "caption"; DwClass.DataValueField = "ID"; DwClass.DataBind(); string Action = Request.QueryString["Action"]; string id = Request.QueryString["ID"]; string pid = Request.QueryString["PID"]; if (Action == "Edit" && id != null) { //是示信息以供修改 strqry = string.Format("select * From T_films where ID={0}", id); DataRow dr = DBFun.GetDataView(strqry).Table.Rows[0]; DwPath.Text = dr["pathid"].ToString(); TbFilmname.Text = dr["film_name"].ToString(); TbOthername.Text = dr["other_name"].ToString(); TbDirector.Text = dr["film_director"].ToString(); TbPlayer.Text = dr["film_player"].ToString(); DwClass.Text = dr["film_classid"].ToString(); DwFrom.Text = dr["film_from"].ToString(); DwLevel.Text = dr["film_level"].ToString(); DwClear.Text = dr["film_clear"].ToString(); CkbBest.Items[0].Selected = (dr["filmisgood1"].ToString() == "1"); CkbBest.Items[1].Selected = (dr["filmisgood2"].ToString() == "1"); TbMoney.Text = dr["film_money"].ToString(); Rbfilmtype.Text = dr["playtype"].ToString(); RbIsReq.Text = dr["filmisseq"].ToString(); TbPicUrl.Text = dr["film_pic"].ToString(); TbGut.Text = dr["film_gut"].ToString().Replace("<br>", "\n");; TbFilmPhyPath.Text = dr["filePhypath"].ToString(); uppath.Value = dr["filefolder"].ToString(); Rb_AllowDown.Text = dr["AllowDown"].ToString(); Rb_Showtype.Text = dr["showType"].ToString(); Tb_SearchKey.Text = dr["SearchKey"].ToString(); img_pic.Src = "..\\film_poster\\" + dr["film_pic"].ToString(); //显示详细集数 strqry = string.Format("select * From T_Film_detail where filmid={0} order by id asc", id); string strDetail = ""; DataView dv = DBFun.GetDataView(strqry); for (int i = 0; i < dv.Table.Rows.Count; i++) { strDetail += "第" + (i + 1) + "集:<input type=text name=urla" + (i + 1) + " size=60 value=" + dv.Table.Rows[i]["filename"].ToString() + ">"; strDetail += " <a href=film_edit.aspx?Action=Delete&ID=" + dv.Table.Rows[i]["id"].ToString() + "&PID=" + id + ">删除</a><br/>"; } Label2.Text = strDetail; //InnerHtml = strDetail; } if (Action == "Delete" && id != null) { strqry = string.Format("Delete From [T_film_detail] where id={0}", id); DBFun.ExecuteSql(strqry); strqry = string.Format("Update [T_films] set film_num=film_num-1,filmupdatetime=#{1}# where id={0}", pid, DateTime.Now.ToString()); DBFun.ExecuteSql(strqry); Response.Redirect("film_edit.aspx?Action=Edit&ID=" + pid); } } }