実行時に 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 を取得して関数を呼び出す方法です。