Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Custom Object used with Profile Object

Custom Object used with Profile Object

Scheduled Pinned Locked Moved C#
csharpasp-netdatabasequestion
1 Posts 1 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • K Offline
    K Offline
    kloepper
    wrote on last edited by
    #1

    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();

    1 Reply Last reply
    0
    Reply
    • Reply as topic
    Log in to reply
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes


    • Login

    • Don't have an account? Register

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • World
    • Users
    • Groups