I've got a user control, its a div with background image and a label on top. I've added the control to default.aspx and now I am trying to set the label.text of the control to "Text".
I keep getting a null reference exception.
Here's the property on the user control
When I hit set it says null exception Label2.text
Here's the call from aspx page
I am passing in a list of folder names and I want those names to show up on each one of the controls
Thanks for the help.
Mark
I keep getting a null reference exception.
Here's the property on the user control
VB.NET:
Public Property LabelText2() As String
Get
Return Label2.Text
End Get
Set(ByVal value As String)
Label2.Text = value
End Set
End Property
When I hit set it says null exception Label2.text
Here's the call from aspx page
I am passing in a list of folder names and I want those names to show up on each one of the controls
VB.NET:
Private Sub CreateTable(ByVal Rows As Integer, ByVal FldrNames() As String, ByVal Fldrcollection As Generic.IList(Of ASP.ui_controls_folder_ascx))
Dim rowCnt As Integer
Dim cellCnt As Integer
Dim index As Integer = 0
For rowCnt = 1 To Rows + 1
Dim tRow As New TableRow
For cellCnt = 1 To 3
Dim tCell As New TableCell
Dim fldrcontrol As New ASP.ui_controls_folder_ascx
If Not FldrNames(index) Is Nothing Then
tCell.Controls.Add(fldrcontrol)
fldrcontrol.ID = "Folder" + index.ToString 'works fine
fldrcontrol.LabelText2 = FldrNames(index) 'bombs out
tRow.Cells.Add(tCell)
End If
index = index + 1
Next
Me.Table1.Rows.Add(tRow)
Next
Thanks for the help.
Mark
Last edited by a moderator: