Maxymus
Maxymus

Reputation: 1480

Populate Grid With List of objects

public class FinalClass { public Employee emp{ get; set; }

public Customer cust{ get; set; } }

how to bind List<FinalClass> into a Gridview is it possible or should i have to create a separate class with corresponding fields as its properties?

Please help me out.

Upvotes: 0

Views: 197

Answers (1)

Jarrett Widman
Jarrett Widman

Reputation: 6419

I will assume based on how the question is phrased that you already know the basics of how databinding works. Within your GridView you can use something like <%# Eval("Employee.Name") %>

If you specifically want to know about 2-way databinding then in my opinion it would be easier to create a View-Model, what you refer to as "a separate class with corresponding fields as its properties"

Upvotes: 1

Related Questions