我在运行时添加了 WebUserControl,所以我不能使用MyWebUserControl.MyFunction()
,我有一个 MasterPage,我试过这个:
_MainContentPage = CType(_Page.Form.FindControl("MyContentPlaceHolder"), ContentPlaceHolder)
CType(_MainContentPage.FindControl("MyWebUserControl"), myType)
但_MainContentPage.FindControl("MyWebUserControl")
返回一个 TableCell。
我添加 WubUserControl 的方式:
tcValue = New TableCell()
tcValue.Controls.Add(_Page.LoadControl("Paht/WebUserControl"))
tcValue.ID = "MyWebUserControl"
好吧,这就是_MainContentPage.FindControl("MyWebUserControl")
返回 TableCell 的原因,但是如何获取 Webcontrol 并调用函数。