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. datagrid complex object binding

datagrid complex object binding

Scheduled Pinned Locked Moved C#
helpcsswpfwcftutorial
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.
  • N Offline
    N Offline
    nonick2
    wrote on last edited by
    #1

    its alitle hard to explane what i wont.. but i will try any way. lets say i got 2 classes: public class person { private string firstname; private string lastname; private ArrayList exames; // (or HashTable) contaning Exame objects public string FirstName { get{return firstname;} set{firstname = value;} } public string LastName { get{return lastname;} set{lastname = value;} } public ArrayList Exames { get(return exames;} set{exames = value;} } } public Class Exame { private string examename; private int grade; public string ExameName { get{return examename;} set(examename = value;} } public int Grade { get{return grade;} set{grade = value;} } } so far so good.. but now i want to bind the person object to a datagrid. and i want the datagrid to show the next information: person mike = new person(); mike.FirstName = "mike"; mike.LastName = "james; mike.Exames.Add(new Exame()); ((Exame)mike.Exames[0]).ExameName = "english"; ((Exame)mike.Exames[0]).Grade = 100; mike.Exames.Add(new Exame()); ((Exame)mike.Exames[1]).ExameName = "math"; ((Exame)mike.Exames[1]).Grade = 90; in the next way in the grid: FirstName LastName english math (thouse are the column names) "mike" "james" 100 90 (the data itself) (P.S ignore the problem when a persion doesnt have a serten exame.. and all other small error's i know how to overcome them. i just need to know how to show it like this)

    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