blitzkrieg bop Posted October 31, 2003 Posted October 31, 2003 I have a page that has several links. And in my code behind page I create a hyperlink control for each link. Is this necessary? Do I need to have so many or can I create them dynamically somehow? Thanks Quote
Moderators Robby Posted November 1, 2003 Moderators Posted November 1, 2003 you can use the following code... You'll need to get the NavigationURL from either a data store or an Array of some sort. Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load If Not IsPostBack Then createManyControls() End If End Sub Private Sub createManyControls() Dim x As Integer For x = 0 To 10 Dim h As New HyperLink() With h .BorderColor = Color.Red .BorderStyle = BorderStyle.Solid .BorderWidth = Unit.Pixel(1) .Text = "Test this site" .NavigateUrl = "someURL" .CssClass = "SomeCssClass" 'If you wish, use this instead of the properties End With Me.Controls.Add(h) 'or place the controls into a Panel or PlaceHolder Next End Sub Quote Visit...Bassic Software
blitzkrieg bop Posted November 1, 2003 Author Posted November 1, 2003 Thanks Robby! That'll work for me Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.