private void DeleteBtn_Click(Object sender, EventArgs e) { lblErrorMessage.Text = String.Empty; int countOfUse = Module.GetCountByFeature(moduleDefinitionId); if (countOfUse > 0) { lblErrorMessage.Text = Resource.ModuleDefinitionsDeleteInstancesBeforeModuleDefinitionMessage; return; } try { ModuleDefinition.DeleteModuleDefinition(moduleDefinitionId); ModuleDefinition.DeleteSettingsByFeature(moduleDefinitionId); string redirectUrl; if (pageId > -1) { redirectUrl = SiteRoot + "/Default.aspx?pageid=" + pageId.ToInvariantString(); } else { redirectUrl = SiteRoot + "/Admin/ModuleAdmin.aspx"; } WebUtils.SetupRedirect(this, redirectUrl); } catch (DbException) { lblErrorMessage.Text = Resource.ModuleDefinitionsDeleteInstancesBeforeModuleDefinitionMessage; } }