示例#1
0
 protected void Page_Load(object sender, EventArgs e)
 {
     DgLoaiMon.DataSource = dsLoaiMon();
     DgLoaiMon.DataBind();
     DgLoaiMon.HeaderRow.Cells[0].Text = "Mã Loại ";
     DgLoaiMon.HeaderRow.Cells[1].Text = "Tên Loại  ";
 }
示例#2
0
    protected void btnThem_Click(object sender, EventArgs e)
    {
        if ((txtMaLoai.Text != "") && (txtTenLoai.Text != ""))
        {
            try
            {
                ThemLoaiMon(txtMaLoai.Text, txtTenLoai.Text);

                DgLoaiMon.DataSource = dsLoaiMon();
                DgLoaiMon.DataBind();
                DgLoaiMon.HeaderRow.Cells[0].Text = "Mã Loại ";
                DgLoaiMon.HeaderRow.Cells[1].Text = "Tên Loại  ";
                txtMaLoai.Text  = "";
                txtTenLoai.Text = "";
                lblTB.Text      = "Đã thêm vào thành công.";
            }
            catch
            {
                lblTB.Text = "Không thể thêm thông tin này. Vui lòng kiểm tra lại.";
            }
        }
        else
        {
            lblTB.Text = "Không thể thêm thông tin này. Vui lòng kiểm tra lại.";
        }
    }
示例#3
0
 protected void btnXoa_Click(object sender, EventArgs e)
 {
     if (txtMaLoai.Text == "")
     {
         lblTB.Text = "Không thể xóa thông tin này. Vui lòng kiểm tra lại.";
     }
     else
     {
         Xoa_LoaiMon(txtMaLoai.Text);
         DgLoaiMon.DataSource = dsLoaiMon();
         DgLoaiMon.DataBind();
         DgLoaiMon.HeaderRow.Cells[0].Text = "Mã Loại ";
         DgLoaiMon.HeaderRow.Cells[1].Text = "Tên Loại ";
         lblTB.Text      = "Xóa thành công !";
         txtMaLoai.Text  = "";
         txtTenLoai.Text = "";
     }
 }