protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { AirTicketWeb.BLL.TInfotype bll = new AirTicketWeb.BLL.TInfotype(); DropDownList1.DataSource = bll.GetAllList(); DropDownList1.DataTextField = "name"; DropDownList1.DataValueField = "id"; DropDownList1.DataBind(); } }
protected void Button1_Click(object sender, EventArgs e) { string name = this.txtname.Text; AirTicketWeb.Model.TInfotype model = new AirTicketWeb.Model.TInfotype(); model.name = name; AirTicketWeb.BLL.TInfotype bll = new AirTicketWeb.BLL.TInfotype(); bll.Add(model); Maticsoft.DBUtility.js.AlertAndRedirect("Success!", "TInfoType.aspx"); }