protected void m_grid_RowCommand(object sender, GridViewCommandEventArgs e) { try { string commandName = e.CommandName; GridViewRow row = m_grid.FooterRow; if (commandName == "Insert") { clsLoaiThietBi objLoaiThietBi = new clsLoaiThietBi(); string TenLoaiThietBi = ((TextBox)row.FindControl("txtITenLoaiThietBi")).Text; string AliasName = ((TextBox)row.FindControl("txtIAliasName")).Text; byte IsUsing = (byte)((((DropDownList)row.FindControl("txtIIsUsing")).Text=="1")? 1:0); string DonVi = ((DropDownList)row.FindControl("txtIDonVi")).Text; objLoaiThietBi.TenLoaiThietBi = TenLoaiThietBi; objLoaiThietBi.AliasName = AliasName; objLoaiThietBi.IsUsing = IsUsing; objLoaiThietBi.DonVi_Id = DonVi; int _result = objLoaiThietBi.Insert(); if (_result >= 1) { ltlAnnouncement.Text = "Thêm mới loai '" + TenLoaiThietBi + "' thành công!"; } if (_result == -1) { ltlAnnouncement.Text = "Thiết bị '" + TenLoaiThietBi + "' đã tồn tại, bạn nên kiểm tra lại!"; } if (_result == 0) { ltlAnnouncement.Text = "Có lỗi trong quá trình thêm mới!"; } bindData(-1); } } catch (Exception ex) { ltlAnnouncement.Text = "Khong them moi duoc du lieu. Vui long lien he voi quan tri<br>" + ex.Message; } }