SoFunction
Updated on 2025-03-10

How to dynamically load user controls

Write the following code in Page_Load:


string s=("usctrl") ;
string uc= (s== ) ? "~/myweb/userctrl/"  :  "~/myweb/userctrl/""  + s + ".ascx" ;

();   
(LoadControl(uc));