public void LoadParts(string sku) { try { IProductCatalogRepository productCatalogRepository = SharePointServiceLocator.Current.GetInstance <IProductCatalogRepository>(); IEnumerable <Part> parts = productCatalogRepository.GetPartsByProductSku(sku); if (parts != null && parts.Any()) { view.Parts = parts; } else { // Show an errormessage in the view. Note, we couldn't use the ErrorVisualizer here, because // the errorVisualizer is outside of the updatepanel. Only things inside the update panel of // the view will be refreshed when the LoadParts button is clicked. view.ErrorMessage = Resources.NoPartsFoundError; } view.DataBind(); } catch (Exception ex) { // If an unhandled exception occurs in the view, then instruct the ErrorVisualizer to replace // the view with an errormessage. ViewExceptionHandler viewExceptionHandler = new ViewExceptionHandler(); viewExceptionHandler.HandleViewException(ex, ErrorVisualizer); } }