Link in BulletedList from Code

Discussion in 'ASP .Net' started by Jonathan Wood, Nov 7, 2007.

  1. I have a master page that contains a BulletedList.

    <asp:BulletedList runat="server" id="mainmenu" CssClass="nav">
    </asp:BulletedList>

    In my page's Load event, I'm populating the bulleted list based on the role
    of the current user. Right now, my test code looks like this:

    for (int i = 0; i < 8; i++)
    {
    ListItem item = new ListItem();
    item.Text = String.Format("Menu Item {0}", i + 1);
    mainmenu.Items.Add(item);
    }

    The problem is I want to insert an <a> tag so that each list item is a link.

    Does anyone know how to dynmically add items to a BulletedList that include
    HTML markup?

    Thanks.

    --
    Jonathan Wood
    SoftCircuits Programming
    http://www.softcircuits.com
    Jonathan Wood, Nov 7, 2007
    #1
    1. Advertising

  2. Jonathan Wood

    Mansi Shah Guest

    Hi,

    You can Add <a> tag to Bulletedlist like,

    <a>
    <asp:BulletedList runat="server" id="mainmenu" CssClass="nav">
    </asp:BulletedList></a>



    Regards,
    Mansi Shah.

    *** Sent via Developersdex http://www.developersdex.com ***
    Mansi Shah, Nov 7, 2007
    #2
    1. Advertising

  3. Jonathan Wood

    Sunfire Guest

    Hi... I was wondering the same thing. Except my problem is only a certain
    part of list item 7 needs to be a link... how do you do that as well?


    "Mansi Shah" <> wrote in message
    news:...
    >
    > Hi,
    >
    > You can Add <a> tag to Bulletedlist like,
    >
    > <a>
    > <asp:BulletedList runat="server" id="mainmenu" CssClass="nav">
    > </asp:BulletedList></a>
    >
    >
    >
    > Regards,
    > Mansi Shah.
    >
    > *** Sent via Developersdex http://www.developersdex.com ***
    Sunfire, Nov 7, 2007
    #3
  4. Wouldn't that make the entire list a link? Is there no way to make list
    items links?

    --
    Jonathan Wood
    SoftCircuits Programming
    http://www.softcircuits.com

    "Mansi Shah" <> wrote in message
    news:...
    >
    > Hi,
    >
    > You can Add <a> tag to Bulletedlist like,
    >
    > <a>
    > <asp:BulletedList runat="server" id="mainmenu" CssClass="nav">
    > </asp:BulletedList></a>
    >
    >
    >
    > Regards,
    > Mansi Shah.
    >
    > *** Sent via Developersdex http://www.developersdex.com ***
    Jonathan Wood, Nov 7, 2007
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. benliu
    Replies:
    0
    Views:
    361
    benliu
    Aug 22, 2006
  2. Stan SR

    BulletedList inside BulletedList

    Stan SR, Aug 31, 2006, in forum: ASP .Net
    Replies:
    2
    Views:
    2,860
    Stan SR
    Aug 31, 2006
  3. Tony
    Replies:
    0
    Views:
    340
  4. Stan SR

    BulletedList

    Stan SR, Dec 19, 2006, in forum: ASP .Net
    Replies:
    3
    Views:
    540
    Eliyahu Goldin
    Dec 19, 2006
  5. =?Utf-8?B?SmliZXkgSmFjb2I=?=

    <asp:BulletedList>

    =?Utf-8?B?SmliZXkgSmFjb2I=?=, Jan 30, 2007, in forum: ASP .Net
    Replies:
    5
    Views:
    1,032
    =?Utf-8?B?SmliZXkgSmFjb2I=?=
    Jan 30, 2007
Loading...

Share This Page