예제 #1
0
        //public void loadcombobox()
        //{
        //    if (!IsPostBack)
        //    {
        //        ddltheloai.DataSource = data.dsTheLoai();
        //        ddltheloai.DataTextField = "tentheloai";
        //        ddltheloai.DataValueField = "matheloai";
        //        DataBind();
        //    }
        //}

        protected void btnThem_Click(object sender, EventArgs e)
        {
            try
            {
                Playlist pl = new Playlist();
                pl.tenplaylist = txtten.Text;
                pl.nguoitao    = txtnguoitao.Text;
                string path = Server.MapPath("~/images/playlist/");
                anh.PostedFile.SaveAs(path + anh.FileName);
                img.ImageUrl = "~/images/playlist/" + anh.FileName;
                pl.hinhanh   = anh.FileName;
                // pl.matheloai = int.Parse(ddltheloai.SelectedValue);
                pl.matheloai = int.Parse(txtmatheloai.Text);
                data.ThemPlayList(pl);
                msg.Text = "Thêm thành công";
            }
            catch (Exception e1)
            {
                msg.Text = "Có lỗi khi thêm " + e1.Message;
            }
        }