views:

216

answers:

1

Hello,

I Have this code in my page, and I want that every NavigateUrl display another page like : simple.aspx?id=1, simple.aspx?id=2, ...

Where id = c

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs)
 Dim c As Integer = 0
  While c < 5
   Dim Label1 As New Label()
   Dim ltr As New Literal()     
   Dim link As New HyperLink()
   link.NavigateUrl = "simple.aspx"
   link.BackColor = Drawing.Color.Aqua            
   Label1.Text = c.ToString()
   ltr.Text = "<br/>"
   PlaceHolder1.Controls.Add(Label1)
   PlaceHolder1.Controls.Add(link)
   PlaceHolder1.Controls.Add(ltr)
   c += 1
   End While
   End Sub

Thanks.

+1  A: 
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs)
 Dim c As Integer = 0
  While c < 5
   Dim Label1 As New Label()
   Dim ltr As New Literal()     
   Dim link As New HyperLink()
   link.NavigateUrl = "simple.aspx?id=" & c.tostring
   link.BackColor = Drawing.Color.Aqua            
   Label1.Text = c.ToString()
   ltr.Text = "<br/>"
   PlaceHolder1.Controls.Add(Label1)
   PlaceHolder1.Controls.Add(link)
   PlaceHolder1.Controls.Add(ltr)
   c += 1
   End While
   End Sub
Tommy
Thank you very much.
dotNET
No problem, anytime! If this solved your issue, be sure to click the accept check thing - keeps your accept rate high :)
Tommy