usercontrol in a placeholder
I've tried doing the following:
var userControl = UserControls.ProductDetailUserControl();
use开发者_JS百科rControl.ID = "id_SubProduct_"+productId;
userControl.Visible = true;
userControl.ValidationDependentOnControl = productOption.ClientID;
userControl.ConditionallyVisible = productOption;
plhDetails.Controls.Add(userControl);
throws a null exception
Try this
var uProductDetails = (UserControls.ProductDetailUserControl)Page.LoadControl("UserControls/ProductDetailUserControl.ascx");
//set properties
plhDetails.Controls.Add(userControl);
精彩评论