Datagrid, ArrayList, and columns

  • Thread starter Thread starter Guest
  • Start date Start date
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
 
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...??
 
Back
Top