Solved

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

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

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

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

Suggested Solutions

IntroductionWhile developing web applications, a single page might contain many regions and each region might contain many number of controls with the capability to perform  postback. Many times you might need to perform some action on an ASP.NET po…
Introduction This article shows how to use the open source plupload control to upload multiple images. The images are resized on the client side before uploading and the upload is done in chunks. Background I had to provide a way for user…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

747 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

14 Experts available now in Live!

Get 1:1 Help Now