471,317 Members | 1,887 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,317 software developers and data experts.

Custom Object used with Profile Object

a
I have a custom object that inherits from CollectionBase and it does not
successfully bind to GridViews or DropdownLists. My understanding is that
that is because GridViews and Dropdownlists implement IEnumerable, therefore,
if I want my custom object to bind to the gridview or the dropdownlist, I
need to inherit from IEnumerable also, right?

Whatever the answer is, I'm trying to learn what I need to do to get my
custom object to bind to a gridview and a dropdownlist.

I don't think this has anything to do with it, but I'm setting the value of
a Profile object (ASP.NET 2.0) equal to the custom object.

School.Teachers tlTeachers = new School.Teachers();

tlTeachers.Add(new School.Teacher("Buck"));

Profile.Teachers = tlTeachers;

Code like this works:

Label1.Text = Profile.Teachers.Count.ToString(); // The number of items in
the profile object

Label1.Text = Profile.Teachers[1].FirstName.ToString();// The value of an
item at a particular index position

But this does not:

GridView1.DataSource = Profile["Teachers"]; // Populate the GridView1 from
the Profile Object

GridView1.DataBind();
Feb 10 '06 #1
0 1022

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

8 posts views Thread by a | last post: by
reply views Thread by a | last post: by
reply views Thread by Rajesh | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.