Re: Add control to a placeholder

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance

From: Ken Cox [Microsoft MVP] (BANSPAMken_cox_at_sympatico.ca)
Date: 04/11/04


Date: Sun, 11 Apr 2004 19:07:43 -0400

Hi Carlos,

You could add hyperlink controls and then a literal control containing a
<br> after each one like this:

    Private Sub Page_Load _
    (ByVal sender As System.Object, _
    ByVal e As System.EventArgs) _
    Handles MyBase.Load
        Dim intCounter As Integer
        Dim hlnk As HyperLink
        Dim litrl As Literal
        For intCounter = 0 To 5
            hlnk = New HyperLink
            hlnk.NavigateUrl = intCounter.ToString & ".aspx"
            hlnk.Text = "Link " & intCounter.ToString
            litrl = New Literal
            litrl.Text = "<br>"
            PlaceHolder1.Controls.Add(hlnk)
            PlaceHolder1.Controls.Add(litrl)
        Next
    End Sub

Does this help?

Ken
Microsoft MVP [ASP.NET]

"Carlos Cruz" <carlos.cruz@vianw.pt> wrote in message
news:OHbQcy$HEHA.3968@TK2MSFTNGP12.phx.gbl...
> hi,
>
> I want to add controls (hyperlinks) dynamically in code into a
> placeholder.
> I manage to add them but they appear in the same line and I want to show
> each hyperlink in a diferente line (like a left menu).
> How can I do this???
>
> Thanks
> CC
>
>



Relevant Pages

  • RE: Y/N fields/ Option groups. How to design a table?
    ... I have no idea how to open a form with a hyperlink so I can't advise as to ... The references in the code are to the form controls, ... By real estate, I meant room on your form that you could place the invisible ... My thread detail options are static so I have opted to go for the checkboxes ...
    (microsoft.public.access.tablesdbdesign)
  • Re: Using an image in the Hyperlink
    ... because my "description" of using the HyperLink's ImageUrl property ... ImageButton but not the HyperLink is the fact that because they derive from ... you'll need to use two controls. ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: How to set width and height of image using HyperLink Control?
    ... The problem in your code is you're adding the img to the Controls collection ... The hyperlink is not a container control and will not ... > Private Sub Page_Load(ByVal sender As System.Object, ... > Sub AddControls(ByVal ObjectName As String, ByVal Style As String, ByVal ...
    (microsoft.public.dotnet.framework.aspnet.webcontrols)
  • Re: window.status
    ... I don't think there is an override function, but you could create your own ... control that does that by inheriting the HyperLink class. ... adds the JavaScript to all HyperLink Controls. ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: NavigateURL/DataNavigateURLFormatString and Session Variable
    ... First, you cannot use for server controls, the only allowed are data ... it doesn't call the ResolveURL ... You cannot use Page.ResolveURL in your HyperLink, ... Sub FixHyperLink ...
    (microsoft.public.dotnet.framework.aspnet)