显示数据库字段作为链接读取

时间:2012-08-07 08:55:22

标签: c# sql

我正在从项目符号列表中读取数据库中的数据,如下所示

<asp:BulletedList ID="BulletedList1" runat="server" 
            DataSourceID="SqlDataSource1" DataTextField="description" 
            DataValueField="id">
        </asp:BulletedList>
        <asp:SqlDataSource ID="SqlDataSource1" runat="server" 
            ConnectionString="<%$ ConnectionStrings:chaaapaConnectionString4 %>" 
            SelectCommand="SELECT * FROM [quiz]"></asp:SqlDataSource>

我希望它显示为链接。我怎么能这样做?

1 个答案:

答案 0 :(得分:2)

您可以尝试使用DisplayMode =“HyperLink”

<asp:BulletedList 
ID="BulletedList1" 
runat="server"  
DisplayMode="HyperLink"
DataSourceID="SqlDataSource1" 
DataTextField="description" 
DataValueField="id">
</asp:BulletedList>