Windows TableStyles & Mapping Names

Posts   
 
    
Jason
User
Posts: 2
Joined: 20-Jan-2005
# Posted on: 20-Jan-2005 19:47:27   

Hello All!!

I have a quick question about the windows form datagrid.

I have a simple example..I have a project table, and a customer table. The project table has a ProjectID, a ProjectName, and a CustomerID. The customer table has a CustomerID and CustomerName.

In the datagrid, I want to see the ProjectName, and CustomerName. I created a ProjectCollection, retrieved them all, and then created DataGridTableStyle that used only the two columns I needed. For MappingName for the CustomerName DataGridColumnTextBoxColumn, I am using "Custmer.CustomerName". This works in ASP.NET datagrids, but doesn't seem to work for windows ones.

Is there a way I can get the CustomerName to show on the windows datagrid?

Thanks!

Jason

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39933
Joined: 17-Aug-2003
# Posted on: 21-Jan-2005 10:16:54   

You get an error or nothing shows up?

Frans Bouma | Lead developer LLBLGen Pro
Jason
User
Posts: 2
Joined: 20-Jan-2005
# Posted on: 21-Jan-2005 16:54:48   

Otis wrote:

You get an error or nothing shows up?

Nothing shows up....

Basically...I have:

        //create the customer name column first
        DataGridTextBoxColumn CustomerName = new DataGridTextBoxColumn();
        CustomerName.MappingName = "Customer.CustomerName";         
        CustomerName.HeaderText  = "Customer Name";

        //create the project name column second
        DataGridTextBoxColumn ProjectName = new DataGridTextBoxColumn();
        ProjectName.MappingName = "ProjectName";
        ProjectName.HeaderText = "Project Name";

The Project Name column shows up, but the customer one doesn't....if I change the Customer.CustomerName to just CustomerID (which exists in the Project table) it works fine.....

By the way..I've also been talking to Frans over email this morning, and he said it might be best to use a typed list....

Jason

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39933
Joined: 17-Aug-2003
# Posted on: 21-Jan-2005 17:28:16   

I'm Frans wink

Yes, a typed list is the best way to do this, they're made to make these kind of lists easy.

Frans Bouma | Lead developer LLBLGen Pro