Solved

How do I show this in a GridView?

Posted on 2009-05-03
3
217 Views
Last Modified: 2012-05-06
I am really tired and I cant get this to work right.

I have a class as you usee in the code below. How do I show this in a gridview? I can get everything to show except the List<String>

Is it possible?
public class ListOrder
{
 
        String orderid = "";
        String customer = "";
        String employee = "";            
        String shipName = "";              
        String productName = "";
        String productID = "";
        String unitPrice  = "";
        String quantity = "";
        String discount = "";
        String employeeFirstName = "";
        String employeeLastName = "";
        List<String> produkter = new List<String>();
}

Open in new window

0
Comment
Question by:Mickeys
[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
3 Comments
 
LVL 17

Expert Comment

by:OriNetworks
ID: 24290886
GridView1.DataSource = myList;
GridView1.DataBind();

I believe that is the general syntax after you have populated your list
0
 

Author Comment

by:Mickeys
ID: 24292707
Yes and that works just fine except that it wont show List<string> produkter since that is a List. So the question is if there is a way to handle that so that one is shown as well?
0
 
LVL 17

Accepted Solution

by:
OriNetworks earned 500 total points
ID: 24300691
Gridview cannot handle a multidimensional object like this along with a onedimensional string. It would not know how it is suppose to display the data.

If you intend on having the List show in one cell you can use a for loop to loop through each item in produkter and add it to a string.

You can also review this question to see if any suggestions help
http://www.experts-exchange.com/Programming/Languages/.NET/ASP.NET/Q_23549700.html
0

Featured Post

Technology Partners: 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

For those of you who don't follow the news, or just happen to live under rocks, Microsoft Research released a beta SDK (http://www.microsoft.com/en-us/download/details.aspx?id=27876) for the Xbox 360 Kinect. If you don't know what a Kinect is (http:…
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…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

734 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