Ads

Captured Technology - Blog

Add Hyperlinks to an ASP.Net BulletList

Add Hyperlinks to an ASP.Net BulletList

I had the need to add hyperlinks to an asp.net server bulletlist today and found some very good examples online including the following example. This example defines a datasetdatasource as an xml file and them loads the values of the xml file into the bulletlist with hyperlinks included. Easy implementation and clear separation of the control and the data to be displayed by the control.

<form runat="server">
   
       <asp:bulletedlist id="BulletedList1" runat="server"
        displaymode="HyperLink"
        datasourceid="Datasetdatasource1"
        datatextfield="Name"
        datavaluefield="Url" />
    <br />
   
    <asp:datasetdatasource id="Datasetdatasource1" runat="server"
        datafile="NavigationMenu.xml" />
           
</form>
 
<!-- NavigationMenu.xml -->
 
<?xml version="1.0" encoding="utf-8" ?>
<QuickLinks>
    <QuickLink>
        <Name>Whidbey @ ASP.NET</Name>
        <Url>http://www.asp.net/Whidbey</Url>
    </QuickLink>
    <QuickLink>
        <Name>ASP.NET Dev Center</Name>
        <Url>http://msdn.microsoft.com/asp.net/</Url>
    </QuickLink>
    <QuickLink>
        <Name>.NET WebLogs @ ASP.NET</Name>
        <Url>http://weblogs.asp.net</Url>
    </QuickLink>
    <QuickLink>
        <Name>ASP.NET Web Matrix</Name>
        <Url>http://asp.net/WebMatrix</Url>
    </QuickLink>
</QuickLinks>

Blog Directory

Latest technology news.
 Patrick Stevens
 530  246364  2/28/2024

Translate

Categories

Blog Calendar