Bind dataview from Class objects

Hi all
I am looking for a way to bind the below class object to a dataview

A tutorial or code snipet will be appreciated.
Please note.. I alread have a class that read the data from database..  
db connection topic is not relevant

Thanks in Advance

class Airplane
{
    public Airplane(string model, int fuelKg)
    {
        _id = ++lastID; Model = model; _fuelKg = fuelKg;
    }
    private static int lastID = 0;
    public int _id;
    public int ID { get { return _id; } }
    public int _fuelKg;
    public int FuelLeftKg { get { return _fuelKg; } set { _fuelKg = value; } }
    public string _model;
    public string Model { get { return _model; } set { _model = value; } }
    public List<Passenger> _passengers = new List<Passenger>();
    public List<Passenger> Passengers { get { return _passengers; } }
}
class Passenger
{
     public Passenger(string name)
    {
        _id = ++lastID; Name = name;
    }
     private static int lastID = 0;
    public int _id;
    public int ID { get { return _id; } }
    public string _name;
    public string Name { get { return _name; } set { _name = value

Open in new window

ZURINETAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

RouchieCommented:
I wrote this a while back.  It seems to fit fairly well with what you're asking.  The key being to cast your dataitem into the class object.
http://www.codepal.co.uk/show/How_to_DataBind_a_custom_class_object_to_a_GridView
0
ZURINETAuthor Commented:
Hi Rouchie
Thanks for the feedback..
I am looking for C# based solution.

Thanks
0
RouchieCommented:
Yes fair enough.  Have you tried pasting my code into this translation engine?
http://converter.telerik.com/
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
SAMIR BHOGAYTAFreelancer and IT ConsultantCommented:
hi.. you can fill dataview with the help of this function. try this..

public object getdata(string str)
{
string constr;
constr = "ConnectionString";
SqlConnection con = new SqlConnection(constr);
con.Open();
object a;
SqlCommand cmd = new SqlCommand(str,con);
a = cmd.ExecuteScalar();
con.Close();
return a;
}
0
ZURINETAuthor Commented:
Not really what I was looking for..Guess should close this thread
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
.NET Programming

From novice to tech pro — start learning today.