BulletList control problems

Hi, I am creating Dynamic bulletList in asp.net. It gathers the data from the database and creates a list of objects in a list format. think loop through the list and creates a dynamic listitem which I bind to a control on the page.

My problem is that I set the value to the url and text to the name of the link.
But… The value seems to be ignored and the text seems to be converted to a link instead of the value. I tried putting a url in the text part of the control but the anchor tage gets converted. I can decode it but surely there is an easier way to set the text and value of the link dynamically.

my code…


public static List<ListItem> CategoryMenuBuilder(List<Category> CategoryList)
    {
        string querId = "CatId=";
        List<ListItem> CategoryMenu = new List<ListItem>();

foreach(Category menuItem in CategoryList)
        {
            ListItem newItem = new ListItem();
            newItem.Text = menuItem._categoryName;
            //newItem.Value = "product.aspx?" + querId + menuItem._categoryId;
            newItem.Value = "http://www.google.co.uk";
            CategoryMenu.Add(newItem);
        }

        return CategoryMenu;

I then bind it to a control here…



  CategoryMenu.DataSource = Category.CategoryMenuBuilder(Category.CategoryDbBuilder());
        CategoryMenu.DataBind();
  

 <asp:BulletedList ID="CategoryMenu" runat="server" DisplayMode="HyperLink">
    </asp:BulletedList>

I am not too sure why the the databind() does not work, but you could try the follow code instead:

So instead of the the following code:


CategoryMenu.DataSource = Category.CategoryMenuBuilder(Category.CategoryDbBuilder());
        CategoryMenu.DataBind();

You replace it with :



CategoryMenu.Items.Add(new ListItem(menuItem._categoryName, "http://www.google.co.uk"));


Of course, in the above code you might need to put that in a loop for the desired result.