Solved

How to add additional field to a gridview's data source, generic collection?

Posted on 2015-01-15
2
142 Views
Last Modified: 2015-01-15
Hi, I'm using vs2012
I have a List<UserPrincipal> objects that I set as the data source for my gridview control.  I am now asked to add an additional AD user object field that is not part of the class UserPrincipal fields.  How to add this additional field to the gridview or do I need to create a new dataset for this?

Thank you.
0
Comment
Question by:lapucca
2 Comments
 
LVL 20

Accepted Solution

by:
Daniel Van Der Werken earned 500 total points
ID: 40551697
Either create a new data set or create a new object for the generic list.

I generally manually create data sets and return them. This is an arduous task but it gives me more flexibility.

For a fast way, make a new object that encapsulates both:

public class MyUserPrincipal
{
   public UserPrincipal principal;
   public Object myOtherObject;
}

Open in new window


Now, pass the List<MyUserPrincipal> to the grid.
0
 

Author Closing Comment

by:lapucca
ID: 40551703
Such a smart and sleek solution!  Thank you.
0

Featured Post

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
This article shows how to deploy dynamic backgrounds to computers depending on the aspect ratio of display
This is a video describing the growing solar energy use in Utah. This is a topic that greatly interests me and so I decided to produce a video about it.
Concerto provides fully managed cloud services and the expertise to provide an easy and reliable route to the cloud. Our best-in-class solutions help you address the toughest IT challenges, find new efficiencies and deliver the best application expe…

932 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now