Solved

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

Posted on 2015-01-15
2
149 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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Can Angular be used with classic asp.net? 3 29
itextsharp with c# 3 18
Set custom font WPF 2 21
Powershell form - Anchor a button to a dynamically sized groupbox 2 42
This article is for Object-Oriented Programming (OOP) beginners. An Interface contains declarations of events, indexers, methods and/or properties. Any class which implements the Interface should provide the concrete implementation for each Inter…
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…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

735 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