Friday, December 24, 2010
Recently i have got a requirement to load the user control dynamically in to a page.When i drag and drop the user Control in design surface run the app it is working fine but when i load the User Control dynamically(Programmatically) .I am unable to find the Control while post back .So i have started dig the functionality and finally i have Fixed the issue .Here is the solution .
Write the method which take user Control name as a parameter .Call this method wherever it is required Add the placeholder control to your page and name it as "plchUserCtrlContainer"
Write Page OnInit event functionality as i have specified below .
You can find the control using following line of code
Happy coding …..