Method of dynamically loading custom controls by asp.net

  • 2021-06-28 12:22:14
  • OfStack

This article shows an example of how asp.net dynamically loads custom controls.Share it for your reference.The implementation is as follows:

//usercontrol.IndexOper For custom controls 
usercontrol.IndexOper uc=(usercontrol.IndexOper)Page.LoadControl(" Custom Control Path ");
uc.ID = "uc";  // Define Only 1 Indication
//OperContent by PlaceHolder control
OperContent.Controls.Add(uc);

I hope that the description in this paper will be helpful to everyone's C#program design.


Related articles: