1
最初有單獨的aspx頁面和所有工作正常,然後我不得不實施它到主頁面。 此代碼是在幾年前完成的,現在需要轉換爲html5。從主頁面內的發件人對象findcontrold - asp.net
什麼工作是當我提到的控件名稱明確
'find contentplaceholder
Dim mpContentPlaceHolder As ContentPlaceHolder
mpContentPlaceHolder = CType(Master.FindControl("HomePlaceholder"), ContentPlaceHolder)
'find the control
AnnounceSnippet = DirectCast(mpContentPlaceHolder.FindControl("AnnounceSnippet"), Control.ContentSnippet)
主模板的實施之前,以下是工作的罰款
#Region "View Particular Day"
Public Sub lbtDayView_Click(ByVal sender As Object, ByVal e As System.EventArgs)
Dim dtmSelectedDate As DateTime = DirectCast(Page.FindControl(DirectCast(sender, Calendar).ClientID), Calendar).SelectedDate()
但後來因爲它給空指針異常我試圖使用主內容持有人
Dim dtmSelectedDate As DateTime = DirectCast(mpContentPlaceHolder.FindControl(DirectCast(sender, Calendar).ClientID), Calendar).SelectedDate()
sti我不知道。
誰能好心幫>
這裏是我的aspx
<asp:Content ID="BodyContent" runat="server" ContentPlaceHolderID="HomePlaceholder">
......
<uc1:contentsnippet id="AnnounceSnippet" runat="server"></uc1:contentsnippet>
.....
<asp:calendar id="Calendar1" runat="server"></asp:calendar>
</asp:Content>