I'm trying to load a control depending on a category ID that is selected from a drop down list.
This is this code i have within a switch statement to show a usercontrol. This was the only way i knew of doing it and having reusable views. I'm open to other methods as i've read a few people saying to avoid dynamic loading?
var control = Page.LoadControl("~/usercontrols/aCertainForm.ascx");
exampleDivArea.Controls.Add(control);
At the moment it loads fine on a button click that calls the above code but when i postback to the same form again it loses its state for the dynamic control.
Thanks for yours answers in advance, i appreciate it and hopefully soon i'll be able to help others a lot more :)