Dynamic User Controls in asp.net

后端 未结 4 495
死守一世寂寞
死守一世寂寞 2021-01-13 20:20

Hello I am trying to lear how to create Dynamic User Controls in asp.net.

I just know that this type of controls are created or loaded at run time.

Someone k

4条回答
  •  悲&欢浪女
    2021-01-13 20:44

    Typically what people are talking about here is the dynamic instantiation and addition of a control to a placeholder.

    For example

    Control ControlInstance = LoadControl("MyControl.ascx");
    myPlaceholder.Controls.Add(ControlInstance);
    

    The above instantiates MyControl.ascx and places it inside of a placeholder with id of myPlaceholder.

提交回复
热议问题