B
Bob Avallone
I have created a user control (aspc). I want the user of
the control (aspx) to be able to pass a property to the
control at runtime. I think I'm close but I don't have it
quite right.
Here are the key portions of the code.
From the ascx module:
Public gstrTitle As String
Code from the aspx module
<%@ Register TagPrefix="uc1" TagName="Calendar"
Src="Calendar.ascx" %>
<%@ Page Language="vb" AutoEventWireup="false"
Codebehind="WebForm1.aspx.vb"
Inherits="MetaProSystems.GeneralCalendarControl.WebForm1" %
Protected WithEvents uctCalendar As Calendar
Private Sub Page_Load(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles MyBase.Load
'Put user code to initialize the page here
uctCalendar.Visible = True
uctCalendar. gstrTitle = "My Title"
End Sub
gstrTitle is recognized by intellisense .When I step
through the code uctCalendar is set to nothing so
naturally I get an error
Object reference not set to an instance of an object
the control (aspx) to be able to pass a property to the
control at runtime. I think I'm close but I don't have it
quite right.
Here are the key portions of the code.
From the ascx module:
Public gstrTitle As String
Code from the aspx module
<%@ Register TagPrefix="uc1" TagName="Calendar"
Src="Calendar.ascx" %>
<%@ Page Language="vb" AutoEventWireup="false"
Codebehind="WebForm1.aspx.vb"
Inherits="MetaProSystems.GeneralCalendarControl.WebForm1" %
Protected WithEvents uctCalendar As Calendar
Private Sub Page_Load(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles MyBase.Load
'Put user code to initialize the page here
uctCalendar.Visible = True
uctCalendar. gstrTitle = "My Title"
End Sub
gstrTitle is recognized by intellisense .When I step
through the code uctCalendar is set to nothing so
naturally I get an error
Object reference not set to an instance of an object