Datagrid, ArrayList, and columns

G

Guest

Hi,

I have created a class that extends the DataGrid class, and I want my class
to show a table that has as its data an ArrayList of ListNode objects. Each
ListNode has an id, name, and description associated with it. I want the
columns in the table to show as headers "ID", "Name", and "Description". I'm
having some trouble figuring out exactly how to do this. My custom DataGrid
is not showing up in the web app form like it should be. Here is the snippet
of code I have that creates and binds the ArrayList to the datagrid:

testList = new ArrayList();
testList.Add(new BindingObject(1, "One"));
testList.Add(new BindingObject(2, "Two"));
testList.Add(new BindingObject(3, "Three"));
this.DataSource = testList;
this.DataBind();

Anyone have any ideas what I'm doing wrong here? Any help is greatly
appreciated.

Thanks,
Carolyn
 
G

Guest

I ended up adding calls to 2 methods in my class constructor that are in the
Page_Load method: InitializeGrid() and BindData(). I am confused: why do I
need to add those 2 method calls in the constructor for the class that
extends DataGrid when they are already in the Page_Load method? I thought
that Page_Load would fire up and call those methods, but I guess not...??
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top