Solved

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

Posted on 2015-01-15
2
157 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Just a quick little trick I learned recently.  Now that I'm using jQuery with abandon in my asp.net applications, I have grown tired of the following syntax:      (CODE) I suppose it just offends my sense of decency to put inline VBScript on a…
A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…

626 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