A
Allan
I have a userControl that I create based on how many rows I retrieve in a
dataset. I add the control to my page but can't access it during the
page_load. I assume this is due to the control not being actually created
yet, the code is as follows...
For Each row In dt.Rows
Dim travelRowCtrl As New TravelContainer
Me.plcHlderTravelTime.Controls.Add(travelRowCtrl)
travelRowCtrl.loadData(row) 'call to load the data
Next
the loadData call is a public function in the travelRowCtrl it attempts to
access some items in the user control. The code is as follows...
Public Function loadData(ByVal drDataRow As DataRow) As Boolean
cmbMode.SelectedIndex = CType(drDataRow.Item("expense_cd"), Integer)
txtDepartDate.Text = CType(drDataRow.Item("departure_dt"), String)
txtDepartTime.Text = CType(drDataRow.Item("departure_time"), String)
End Function
the result is a system exception "Object reference not set to an instance of
an object. "
QUESTION: Is there away to access this control during page_load? If so how
should I do it.
dataset. I add the control to my page but can't access it during the
page_load. I assume this is due to the control not being actually created
yet, the code is as follows...
For Each row In dt.Rows
Dim travelRowCtrl As New TravelContainer
Me.plcHlderTravelTime.Controls.Add(travelRowCtrl)
travelRowCtrl.loadData(row) 'call to load the data
Next
the loadData call is a public function in the travelRowCtrl it attempts to
access some items in the user control. The code is as follows...
Public Function loadData(ByVal drDataRow As DataRow) As Boolean
cmbMode.SelectedIndex = CType(drDataRow.Item("expense_cd"), Integer)
txtDepartDate.Text = CType(drDataRow.Item("departure_dt"), String)
txtDepartTime.Text = CType(drDataRow.Item("departure_time"), String)
End Function
the result is a system exception "Object reference not set to an instance of
an object. "
QUESTION: Is there away to access this control during page_load? If so how
should I do it.