Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 221
  • Last Modified:

How do I show this in a GridView?

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
Mickeys
Asked:
Mickeys
  • 2
1 Solution
 
OriNetworksCommented:
GridView1.DataSource = myList;
GridView1.DataBind();

I believe that is the general syntax after you have populated your list
0
 
MickeysAuthor Commented:
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
 
OriNetworksCommented:
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!

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now