Help creating dynamic links & label fill in aspx

S

simon

Hello,
i'm looking to create an aspx page that is basically a FAQ page
i'm not sure if this can be done, but would love some help with
suggestions of how to do it another way if this is not possible

on the aspx page i have a table with 1 row and 2 columns in it, in the
column on the left i have an asp:label, lblLinks and in the column on
the right i have another asp:label, lblBody

i'm reading the content of the links and body from the database
i'd like to be able to dynamically create the links, so i was creating
them like this is a dataSet loop:
"<a href="FAQ.aspx?section=" + drRow.Item("Section") + ">" +
drRow.Item("Section") + "</a>"

OR

Dim i As Integer
i = 1
For Each drRow In copyDataSet.Tables(0).Rows
lblLinks.Text = lblLinks.Text + _
"<asp:LinkButton id=LinkButton" + i.ToString() + "
runat=server>" + drRow.Item("Section") + "</asp:LinkButton> <br>"
i += 1
Next

this isn't working because i'm not using frames, what i'd like to do
is have an onClick of this link that calls a codebehind function that
then fills the lblBody with the content read from the database.

my main question is how i can dynamically create link and have them
once clicked call the codebehind to fill another label with something
else read from the database.

thank you for any help
 
G

Guest

Dim x As New linkbutton
....
x.CommandArgument = ...
me.controls.add(x)
AddHandler x.Command, AddressOf subx
End Sub

Sub subx(ByVal sender As Object, ByVal e As
System.Web.UI.WebControls.CommandEventArgs)
Select Case e.CommandArgument
Case "Hello World"
.... do something here
End Select
End Sub


Good Luck
Simon
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top