protected override void OnInit(EventArgs e) { try { provider=BlogEntryEditorProvider.Instance(); provider.ControlId=this.ID; provider.InitializeControl(); if(_height != Unit.Empty) provider.Height = _height; if(_width != Unit.Empty) provider.Width=_width; editor = provider.RichTextEditorControl; this.Controls.Add(editor); base.OnInit (e); } catch (ArgumentNullException ex) { OnError(ex); } catch (InvalidOperationException ex) { OnError(ex); } catch (UnauthorizedAccessException ex) { OnError(ex); } }
/// <summary> /// Initialize text editor provider and controls /// /// Note: made public to be accessible by unit tests /// </summary> /// <param name="e">EventArgs</param> public void InitControls(EventArgs e) { try { _provider = CreateProvider(); _provider.ControlId = ID; _provider.InitializeControl((Page as SubtextPage).SubtextContext); if (Height != Unit.Empty) { _provider.Height = Height; } if (Width != Unit.Empty) { _provider.Width = Width; } editor = _provider.RichTextEditorControl; Controls.Add(editor); base.OnInit(e); } catch (ArgumentNullException ex) { OnError(ex); } catch (InvalidOperationException ex) { OnError(ex); } catch (UnauthorizedAccessException ex) { OnError(ex); } }