I want to create an FAQ page like this link http://www.bigfatwebhosting.co.uk/help/index.php?view=2#top
I would appreciate some tips on this. Thanks
I would appreciate some tips on this. Thanks
<a href="#Link1">Goto Link1</a><br />
<a href="#Link2">Goto Link2</a>
<a name="Link1"><h1>Link1</h1>
your paragraphs of text here
<br />
<a name="Link2"><h1>Link2</h1>
more paragraphs of text here
<a href="#">back to top</a>
For i = 0 To ds.Tables(0).Rows.Count - 1
Response.Write("<left><li><a href=""FaqAns.aspx?id=" & ds.Tables(0).Rows(i).Item("faq_id") & """>")
Response.Write(ds.Tables(0).Rows(i).Item("question") & "</a></li></left>")
Next
on the first page i am writing all questions as links to the screen. Alternatively i am trying repeater control.
my code on the second page:
Dim sql As String = "select * from Faq where faq_id = " & Request("id")
Dim ds As New DataSet
Dim da As New SqlDataAdapter(sql, con)
da.Fill(ds)
Me.lblQues.Text = ds.Tables(0).Rows(0).Item("question")
Me.DataGrid1.DataSource = ds.Tables(0)
Me.DataGrid1.DataBind()
CType(e.Item.FindControl("NameOfControl"), HyperLink).NavigateURL = "#" & DataRow("FieldName").ToString
DataBinder.Eval: 'System.Data.DataRowView' does not contain a property with the name answer.
<script language="JavaScript">
function ToggleDisplay(id)
{
var elem = document.getElementById('d' + id);
if (elem)
{
if (elem.style.display != 'block')
{
elem.style.display = 'block';
elem.style.visibility = 'visible';
}
else
{
elem.style.display = 'none';
elem.style.visibility = 'hidden';
}
}
}
</script>
<style>
.header { FONT-WEIGHT: bold; FONT-SIZE: larger; CURSOR: pointer; FONT-FAMILY: Verdana; BACKGROUND-COLOR: #cccccc }
.details { DISPLAY: none; VISIBILITY: hidden; FONT-FAMILY: Verdana; BACKGROUND-COLOR: #eeeeee }
</style>
</HEAD>
<BODY bgColor="buttonface" MS_POSITIONING="GridLayout">
<FORM id="Form1" method="post" runat="server">
<asp:Repeater id="rptFaqs" runat="server">
<ItemTemplate>
<div id='h<%# Databinder.Eval(Container, "ItemIndex")%>'class="header" onclick='ToggleDisplay(<%# Databinder.Eval(container, "ItemIndex")%>);'><%# Databinder.Eval(Container.Dataitem, "question")%></div>
<div id='d<%# Databinder.Eval(Container, "ItemIndex")%>'class="details"><%# Databinder.Eval(Container.Dataitem, "answer")%></div>
</ItemTemplate>
</asp:Repeater>
</FORM>
</BODY>
</HTML>
<script language="JavaScript">
function ToggleDisplay(id)
{
var elem = document.getElementById('d' + id);
if (elem)
{
if (elem.style.display != 'block')
{
elem.style.display = 'block';
elem.style.visibility = 'visible';
}
else
{
elem.style.display = 'none';
elem.style.visibility = 'hidden';
}
}
}
</script>