The code runs through without errors. However my controls, LinkButton01, Image01 and Button01 do not appear on my web page. I have added the code as code behind and in front. Both times they did not appear. I am sure there is a trick I am missing here. Please assist as I am about to crack.

EventInvites is a coma delimited string, eg david,mary,peter etc. This is reason I need PlaceHolder because the string's can be any length. With each name I retrieve the userkey, with userkey I retrieve Image Url to display.

Dim usr As New UserClass
            Dim img As New UserImageClass
            Dim uname As String = ""
            Dim inviteeuserkey As Integer = 0
            Dim inviteeImageUrl As String = ""
            Dim ind As Integer = 0
            Dim PlaceHolder1 As New PlaceHolder()
            Dim linkbutton01 As New LinkButton
            Dim image01 As New System.Web.UI.WebControls.Image
            Dim button01 As New System.Web.UI.WebControls.Button
            Dim spacer As LiteralControl = New LiteralControl("<br />")
            button01.Text = "Here"
            button01.ForeColor = Color.Red

            For x = 0 To EventInvites.Length - 1
                If EventInvites(x) = "," Then
                    ret = CStr(usr.RetrieveUserKey(uname))
                    If InStr(ret, "Error") > 0 Then
                        ErrorLabel.Text = Left(ret, 100)
                        ErrorLabel.Visible = True
                        Exit Sub
                    End If

                    Try
                        inviteeuserkey = CInt(Val(ret))
                    Catch ex As Exception
                        inviteeuserkey = 0
                    End Try

                    If inviteeuserkey > 0 Then
                        ret = CStr(img.retrieveMainImage(inviteeuserkey))
                        If InStr(ret, "Error") > 0 Then
                            ErrorLabel.Text = Left(ret, 100)
                            ErrorLabel.Visible = True
                            Exit Sub
                        End If

                        If ret = "" Then
                            ret = MeHeadImagePath
                        End If

                        image01.ImageUrl = ret
                        linkbutton01.Text = uname
                        linkbutton01.ForeColor = Color.Blue
                        PlaceHolder1.Controls.Add(linkbutton01)
                        PlaceHolder1.Controls.Add(spacer)
                        PlaceHolder1.Controls.Add(image01)
                        PlaceHolder1.Controls.Add(spacer)
                        PlaceHolder1.Controls.Add(button01)
                        PlaceHolder1.Visible = True



                        uname = ""
                    Else
                        ErrorLabel.Text = "Error: User Key not found for Invitee: " & uname
                        ErrorLabel.Visible = True
                        Exit Sub
                    End If
                Else
                    uname = uname & EventInvites(x)
                End If
            Next x
            x = 0
        End If

<div>

<asp:PlaceHolder ID="PlaceHolder1" runat="server" Visible="false" ></asp:PlaceHolder>

</div>

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.