//also deletes webpage if it is empty. public static void DestroyMasterDetailItem(int moduleId) { //get the module object. WebModuleInfo module = WebModule.GetModule(moduleId); //get the container page of the module. WebpageInfo page = module.Webpage; //this cascades and destroys the MasterDetail associated items/resources. WebModule.DeleteModule(moduleId); //destory the item (this cascades down the resources). //MasterDetail_Item.Destroy(moduleId); //destory all associated item resources. //MasterDetail_ItemResource.Destroy(MasterDetail_ItemResource.Columns.ModuleId, moduleId); //if the page has no modules left on it, remove it also. if (null == page.Modules || page.Modules.Count == 0) { Webpage.DeleteWebpage(page.InstanceId); } }
protected void EditDeleteButton_Click(object sender, EventArgs e) { WebModule.DeleteModule(_moduleId); Response.Redirect(_urlReferrer); }