public void RemoveView(ReportView parent, ReportView view)
{
if (parent == null)
{
foreach (ReportOutput output in Outputs)
{
if (output.ViewGUID == view.GUID) throw new Exception(string.Format("Unable to remove the view '{0}': This view is used by the output '{1}'.", view.Name, output.Name));
}
if (Views.Count == 1) throw new Exception("Unable to remove the view: The report must contain at least one View.");
Views.Remove(view);
//Change the default view if necessary
if (view.GUID == ViewGUID) ViewGUID = Views[0].GUID;
}
else parent.Views.Remove(view);
}