Loading...

PlaceHolder


PlaceHolder Example
@using System.Web.UI.HtmlControls
@inherits ControlComponent

<asp.PlaceHolder _ref="() => this.placeHolder" />

@code {
                                            private PlaceHolder placeHolder = new PlaceHolder();

                                            protected override void OnLoad(object sender, EventArgs e)
    {
                                            if (!this.Page.IsPostBack)
        {
            HtmlButton myButton = new HtmlButton();
            myButton.InnerText = "Button 1";
            placeHolder.Controls.Add(myButton);
            myButton = new HtmlButton();
            myButton.InnerText = "Button 2";
            placeHolder.Controls.Add(myButton);
            myButton = new HtmlButton();
            myButton.InnerText = "Button 3";
            placeHolder.Controls.Add(myButton);
            myButton = new HtmlButton();
            myButton.InnerText = "Button 4";
            placeHolder.Controls.Add(myButton);
        }
    }
}
PlaceHolder LoadControl Example

Counter

Current count: 0

@using BlazorWebFormDemo.Pages
@inherits ControlComponent

<asp.PlaceHolder _ref="() => this.placeHolder" />

@code {
                                            private PlaceHolder placeHolder = new PlaceHolder();

                                            protected override void OnLoad(object sender, EventArgs e)
    {
                                            if (!this.Page.IsPostBack)
        {
            DynamicComponentControl counter = (DynamicComponentControl)this.Control.LoadControl(typeof(Counter));
            placeHolder.Controls.Add(counter);
        }
    }
}

PlaceHolder Metadata
Name Type Kind
Attributes IReadOnlyDictionary Parameter
ClientIDMode ClientIDMode Parameter
ID String Parameter
Visible Boolean Parameter
OnDataBinding EventHandler Event
OnDisposed EventHandler Event
OnInit EventHandler Event
OnLoad EventHandler Event
OnPreRender EventHandler Event
OnUnload EventHandler Event
Copyright © 2024 Jurio li All rights reserved.
An unhandled error has occurred. Reload 🗙