protected void Button1_Click(object sender, EventArgs e) { Bll_BSCategory.Insert(new BSCategory() { BLName = TextBox1.Text, BLID = Convert.ToInt32(DropDownList1.SelectedValue) }); Response.Redirect("GoodSType.aspx"); }
private void GrideView1Bind() { if (Request.QueryString["BLID"] != null) { DropDownList1.SelectedValue = Request.QueryString["BLID"]; GridView1.DataSource = Bll_BSCategory.Select_BLAndBS_BLID(Convert.ToInt32(Request.QueryString["BLID"])); GridView1.DataBind(); } else { GridView1.DataSource = Bll_BSCategory.Select_All(); GridView1.DataBind(); } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { if (Request.QueryString["BLID"] == null) { Repeater1.DataSource = Bll_BSCategory.Select_All(); Repeater1.DataBind(); } else { Repeater1.DataSource = Bll_BSCategory.Select_BLAndBS_BLID(Convert.ToInt32(Request.QueryString["BLID"])); Repeater1.DataBind(); } } }
protected void GridView1_RowUpdating(object sender, GridViewUpdateEventArgs e) { string BLName = ((GridView1.Rows[e.RowIndex].Cells[0].Controls[0]).FindControl("TextBox1") as TextBox).Text; int BLID = Convert.ToInt32((GridView1.Rows[e.RowIndex].FindControl("DropDownList2") as DropDownList).SelectedItem.Value); int BSID = Convert.ToInt32(GridView1.DataKeys[GridView1.EditIndex].Value); //Response.Write(BLName+"__"+BLID+"__"+BSID); Bll_BSCategory.Update(new BSCategory() { BLID = BLID, BSID = BSID, BLName = BLName }); GridView1.EditIndex = -1; GrideView1Bind(); }
protected void Page_Load(object sender, EventArgs e) { if (Session["AName"] == null) { Response.Redirect("Default.aspx"); } book = Bll_Book.Select_BID(Convert.ToInt32(Request.QueryString["BID"])); if (!IsPostBack) { DropDownList1.DataSource = Bll_BSCategory.Select_All(); DropDownList1.DataValueField = "BSID"; DropDownList1.DataTextField = "BLName"; DropDownList1.DataBind(); TextBox1.Text = book.BName; TextBox5.Text = book.BAuthor; TextBox2.Text = book.BISBN; DropDownList1.SelectedValue = book.BSID.ToString(); TextBox3.Text = book.BPrice.ToString(); TextBox4.Text = book.BCount.ToString(); TextBox8.Text = book.BSaleCount.ToString(); TextBox6.Text = book.BTOC; TextBox7.Text = book.BComment; } }
protected void Repeater1_ItemDataBound(object sender, RepeaterItemEventArgs e) { (e.Item.FindControl("Repeater2") as Repeater).DataSource = Bll_BSCategory.Select_BLID(((e.Item.DataItem) as Model.BLCategory).BLID); (e.Item.FindControl("Repeater2") as Repeater).DataBind(); }
protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e) { Bll_BSCategory.Delete_BSID(Convert.ToInt32(GridView1.DataKeys[e.RowIndex].Value)); GrideView1Bind(); }