Help please Creating web page of links and content

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>"

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
 
S

simon

one other thing i thought i of, but don't believe it will work, is to
create asp:LinkButton's instead of regular hyperlinks. but since
these would be created on the fly in the codebehind, i wouldn't think
that would be allowed because i assume the asp.net elements need to be
already coded on the page so they can be registered when the page
compiles?
maybe i'm making a mountain out of a molehill :) thanks for any help
 
S

simon

I should probably have all my thought and attempts done before
replying, but i tried this and wanted to post what happened. code
below does display the info i want (link names), but the links are not
active, it is only text displayed

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

when i look at the source (right-click, view source) the linkbuttons
are created (or at least the correct text that would define a
linkbutton), but it is just text, nothing active. so i'm assuming my
theory of creating objects on the fly this way can't be done (at least
the way i'm trying)?
thanks, i'll wait to reply before filling up this thread myself :)
appreciate any advice....
 

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

Top