protected void m_grid_RowCommand(object sender, GridViewCommandEventArgs e) { try { string commandName = e.CommandName; GridViewRow row = m_grid.FooterRow; if (commandName == "Insert") { clsDonVi objDonVi = new clsDonVi(); string TenDonVi = ((TextBox)row.FindControl("txtIIndex")).Text; string DiaChi = ((TextBox)row.FindControl("txtIEthnic")).Text; string Tel = ((TextBox)row.FindControl("txtITel")).Text; string Fax = ((TextBox)row.FindControl("txtIFax")).Text; string SMSCenter = ((TextBox)row.FindControl("txtISMSCenter")).Text; objDonVi.TenDonVi = TenDonVi; objDonVi.DiaChi = DiaChi; objDonVi.Tel = Tel; objDonVi.Fax = Fax; objDonVi.SMSCenter = SMSCenter; int _result = objDonVi.Insert(); if (_result >= 1) { ltlAnnouncement.Text = "Thêm mới đơn vị '" + TenDonVi + "' thành công!"; } if (_result == -1) { ltlAnnouncement.Text = "Đơn vị '" + TenDonVi + "' đã 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; } }