Jump to content

Dynamic Hyperlink


lovelyhelp

Recommended Posts

Hmmm, not a very specific question. You should really be reading up on database design and asp.net coding if you have to ask questions like this. With that in mind, I hope the following makes sense.First for the db. I would recommend having a chapter table and a sub chapter table with appriopriate primary and secondary keys linking them together to create a 1 chapter has many sub chapters relationship.Then for the code I would run a query that accesses all the chapters and then gets all the sub chapter for each main chapter. A stored procedure on your sql database would make this a little cleaner and help seperate out the database and coding logic.An alternative to using a database would be to use XML files, they would be faster to access and would leave your database to do more application critical operations, rather than worry about compiling the menu.Hope this helps to get you started!

Link to comment
Share on other sites

i have my code in this way <%@ Import Namespace="System.Data" %><%@ Import Namespace="System.Data.SqlClient" %><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><script runat="server"> Sub Page_load() If Not IsPostBack Then Dim conTutorial As SqlConnection Dim cmdSelect As SqlCommand Dim dtrLinks As SqlDataReader conTutorial = New SqlConnection("server=localhost;UID=userlogin;psw=119478;database=userlogin") cmdSelect = New SqlCommand("select * from t_hyperlink", conTutorial) conTutorial.Open() dtrLinks = cmdSelect.ExecuteReader() rptLinks.DataSource = dtrLinks rptLinks.Databind() dtrLinks.Close() conTutorial.Close() End If End Sub</script>:: <tr> <td style="width: 110px"> <asp:Repeater ID="rptLinks" runat="Server"> <ItemTemplate> <li> <asp:HyperLink runat="server" Text='<%# container.DataItem("tutorial_subject") %>' NavigateUrl='<%# container.dataitem("tutorial_hyperlink") %>'></asp:HyperLink> </li> </itemtemplate></asp:Repeater>::

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...