我有一个带有表单元素的UserControl,我动态加载子表单:
subForm = Page.LoadControl("/subforms/ReservationType_" + value + ".ascx")
DynamicFormPart.Controls.Add(subForm);
如何在动态加载的子表单上访问表单元素的值?
这些东西不起作用:
var gameCheckBox = _subForm.FindControl("GameCheckBox") as CheckBox;
var gameCategory = DynamicFormPart.FindControl("GameCategory") as DropDownList;
var checkBoxMtbDistance = this.Page.FindControl("CheckBoxMtbDistance") as CheckBox;
那怎么办呢?谢谢!