Example #1
0
      /// <summary>
      /// Adds the control.
      /// </summary>
      /// <param name="templateName">Name of the template.</param>
      /// <param name="virtualPath">The virtual path.</param>
      public void AddControl( string templateName, string virtualPath )
      {
         if ( string.IsNullOrEmpty( templateName ) )
            throw new ArgumentNullException( "templateName", "Template name must not be null or empty." );

         if ( string.IsNullOrEmpty( virtualPath ) )
            throw new ArgumentNullException( "virtualPath", "The virtual path must not be null or empty." );

         Template template;
         if ( !_page.Templates.TryGetValue( templateName, out template ) )
         {
            template = new Template();
            _page.Templates.Add( templateName, template );
         }
         template.AddControl( virtualPath );
      }
Example #2
0
      /// <summary>
      /// Adds the control.
      /// </summary>
      /// <param name="templateName">Name of the template.</param>
      /// <param name="controlInstance">The control instance.</param>
      public void AddControl( string templateName, Control controlInstance )
      {
         if ( string.IsNullOrEmpty( templateName ) )
            throw new ArgumentNullException( "templateName", "Template name must not be null or empty." );

         if ( null == controlInstance )
            throw new ArgumentNullException( "controlInstance", "The control instance must not be null." );

         Template template;
         if ( !_page.Templates.TryGetValue( templateName, out template ) )
         {
            template = new Template();
            _page.Templates.Add( templateName, template );
         }
         template.AddControl( controlInstance );
      }