I'm retrieving data pulled from SQL via an XML feed from my website, and each item has an id, name, description which is stuck into an ArrayList, which is then added to an overall ArrayList - this basically represents the rows retrieved from my database.


catArray = new ArrayList();


So Q1) I kindof feel this arraylist of arraylists is not the right way to do it, but am a bit unsure how else to contain all this info. enums? keep it as separate id, name and desc arraylists? make a datatable?

Next I need to display the info; basically a list of hyperlinked category names which I can assign a click event to and load info on that particular category. This seems fantastically simple but I am struggling with it.

So Q2) I've sort of got this to work by adding into a listbox, but really I want separate links added into a stackpanel. How would I set this up? Make custom controls?


First of all I'd suggest to use List<T>.

public class Category
     public int ID {get;set;}
     public string Name {get;set;}
     public string Description { get;set;}

Create a List<Category>.

List<Category> list=new List<Category>();

list.add(new Category()

That's great thanks, I have sorted the linking bit now so this should help me clean up the data a bit.

This article has been dead for over six months. Start a new discussion instead.