Rock.Web.UI.Controls.SecurityFieldTemplate.InstantiateIn C# (CSharp) Method

InstantiateIn() public method

When implemented by a class, defines the T:System.Web.UI.Control object that child controls and templates belong to. These child controls are in turn defined within an inline template.
public InstantiateIn ( Control container ) : void
container System.Web.UI.Control The object to contain the instances of controls from the inline template.
return void
        public void InstantiateIn( Control container )
        {
            DataControlFieldCell cell = container as DataControlFieldCell;
            if ( cell != null )
            {
                SecurityField securityField = cell.ContainingField as SecurityField;
                HtmlGenericControl aSecure = new HtmlGenericControl( "a" );
                cell.Controls.Add( aSecure );
                aSecure.Attributes.Add("class", securityField.ButtonCssClass );

                // height attribute is used by the modal that pops up when the button is clicked
                aSecure.Attributes.Add( "height", "500px" );

                HtmlGenericControl buttonIcon = new HtmlGenericControl( "i" );
                buttonIcon.Attributes.Add( "class", securityField.IconCssClass );
                aSecure.Controls.Add( buttonIcon );

                aSecure.DataBinding += new EventHandler( aSecure_DataBinding );
            }
        }