protected void chkBoxActivation_CheckedChanged(object sender, EventArgs e) { ModuleType mt = null; try { CheckBox box = (CheckBox)sender; if (box.InputAttributes["moduleTypeId"] != null) { mt = _moduleTypeService.GetModuleById(int.Parse(box.InputAttributes["moduleTypeId"])); if (box.Checked) { //set activation status mt.AutoActivate = true; _moduleTypeService.SaveOrUpdateModuleType(mt); //activate now ModuleLoader.ActivateModule(mt); } else { //set activation status mt.AutoActivate = false; _moduleTypeService.SaveOrUpdateModuleType(mt); } } BindModules(); } catch (Exception ex) { if (mt != null) { ShowError("Nạp không thành công cho " + mt.Name + ".<br/>" + ex.Message); } else { ShowError("Không nạp được phân hệ.<br/>" + ex.Message); } } }