I am trying to call DotNetNuke.Common.Utilities.Calendar.InvokePopupCal on a Calendar link I have setup in the EditTemplate of a FormView, using the following code in my .vb codebehind file:
Dim tmpCalLink As HyperLink = FormView1.FindControl("cmdCalendar")
Dim tmpDateOppStart As TextBox = FormView1.FindControl("DateOppStartTextBox")
tmpCalLink.NavigateUrl = DotNetNuke.Common.Utilities.Calendar.InvokePopupCal(tmpDateOppStart)
And in my .ascx file: (this falls within the EditTemplate of FormView1:
<asp:TextBox ID="DateOppStartTextBox" runat="server" Text='<%# Bind("DateOppStart") %>'></asp:TextBox>
<asp:hyperlink id="cmdCalendar" resourcekey="Calendar" cssclass="CommandButton" runat="server">Calendar</asp:hyperlink>
I get the error:
|
A critical error has occurred.
Object reference not set to an instance of an object. |
And my Event Log shows:
AssemblyVersion: 04.05.05
PortalID: 0
PortalName: XXXXXXX DEV
UserID: 1
UserName: host
ActiveTabID: 93
ActiveTabName: Manage Vol Opps
RawURL: /default.aspx?tabid=93&id=119
AbsoluteURL: /default.aspx
AbsoluteURLReferrer: http://XXXXXXX/TestOrg/tabid/77/Default.aspx
UserAgent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; .NET CLR 2.0.50727; .NET CLR 3.0.04506.648; .NET CLR 3.5.21022; .NET CLR 1.1.4322)
DefaultDataProvider: DotNetNuke.Data.SqlDataProvider, DotNetNuke.SqlDataProvider
ExceptionGUID: 95d4b4ab-0a07-4f24-bd1e-b013769f100d
InnerException: Object reference not set to an instance of an object.
FileName:
FileLineNumber: 0
FileColumnNumber: 0
Method: DotNetNuke.Common.Utilities.Calendar.InvokePopupCal
StackTrace:
Message: DotNetNuke.Services.Exceptions.PageLoadException: Object reference not set to an instance of an object. ---> System.NullReferenceException: Object reference not set to an instance of an object. at DotNetNuke.Common.Utilities.Calendar.InvokePopupCal(TextBox Field) at YourCompany.Modules.cn_VolOpps.Viewcn_VolOpps.Page_Load(Object sender, EventArgs e) in http://server//DesktopModules/cn_VolOppsForOrg/Viewcn_VolOpps.ascx.vb:line 22 at System.Web.UI.Control.OnLoad(EventArgs e) at System.Web.UI.Control.LoadRecursive() at System.Web.UI.Control.LoadRecursive() at System.Web.UI.Control.LoadRecursive() at System.Web.UI.Control.LoadRecursive() at System.Web.UI.Control.LoadRecursive() at System.Web.UI.Control.LoadRecursive() at System.Web.UI.Control.LoadRecursive() at System.Web.UI.Control.LoadRecursive() at System.Web.UI.Control.LoadRecursive() at System.Web.UI.Control.LoadRecursive() at System.Web.UI.Control.LoadRecursive() at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) --- End of inner exception stack trace ---
Source:
Server Name: SERVER3
where line 22 is (from above):
tmpCalLink.NavigateUrl = DotNetNuke.Common.Utilities.Calendar.InvokePopupCal(tmpDateOppStart)
If I use it on a page that doesn't have the FormView, and reference the controls directly without the FormView1.FindControl, it works as expected.
Can anyone provide some guidance? Many thanks!