public void BindDate() { //绑定歌曲类型到下拉文本框 BLL.T_Style BllStyle = new T_Style(); DropDownList1.DataSource = BllStyle.select().Tables[0]; DropDownList1.DataTextField = "Style"; DropDownList1.DataValueField = "Id"; DropDownList1.DataBind(); //绑定歌手姓名到下拉文本框 BLL.T_Singer BllSinger = new T_Singer(); DpDSinger.DataSource = BllSinger.select().Tables[0]; DpDSinger.DataTextField = "Name"; DpDSinger.DataValueField = "Id"; DpDSinger.DataBind(); }
protected void GVSinger_RowUpdating(object sender, GridViewUpdateEventArgs e) { BLL.T_Singer SingerBll = new T_Singer(); if (SingerBll.Select(Convert.ToInt32(GVSinger.Rows[e.RowIndex].Cells[0].Text)).Tables[0].Rows.Count > 0) { S_Id.Value = SingerBll.Select(Convert.ToInt32(GVSinger.Rows[e.RowIndex].Cells[0].Text)).Tables[0].Rows[0][0].ToString(); SingerName.Text = SingerBll.Select(Convert.ToInt32(GVSinger.Rows[e.RowIndex].Cells[0].Text)).Tables[0].Rows[0][1].ToString(); //SingerSex.SelectedValue = SingerBll.Select(Convert.ToInt32(GVSinger.Rows[e.RowIndex].Cells[0].Text)).Tables[0].Rows[0][2].ToString(); Add.Visible = false; Update.Visible = true; } else { Response.Write("No Date"); } }
protected void GVSinger_RowDeleting(object sender, GridViewDeleteEventArgs e) { Model.T_Singer Singer = new Model.T_Singer(); BLL.T_Singer SingerBll = new T_Singer(); //Singer.Id = Convert.ToInt32(GVSinger.Rows[e.RowIndex].Cells[0].Text); Singer.Id = Convert.ToInt32(SingerBll.Select(Convert.ToInt32(GVSinger.Rows[e.RowIndex].Cells[0].Text)).Tables[0].Rows[0][0].ToString()); if (SingerBll.Delete(Singer)) { Response.Write("DONE"); BindDate(); } else { Response.Write("FAILURE"); } }