Datagrid tablestyle problem

G

Guest

I have a datagrid with tablestyles and columnstyles set up using the
designer, there are 4 columns, bount to 4 of the properties of an object held
in an arraylist

the binding works fine, the data displaying correctly and is editable,
however the table and columnstyles are ignored when displaying, the grid just
using the default formatting and displays all properties of the object. I
have checked that the grid has the correct table and columnstyles after
binding.

any ideas where I can look?

guy
 
C

Cor Ligthert

Guy,

One of the possiblilities (what is mostly the problem in this) is that you
have not set the mappingname of your datagridtablestyle and/or the
datagridcolumnstyles.

I hope this helps?

Cor
 
G

Guest

Hi Cor,

I have the following code to set the mapping name:-
me.dgBlocks.TableStyles(0).MappingName = lic.Blocks.GetType().Name

and for the ColumnStyles the MappingName is the name of each Property I want
to display

is this correct

cheers

guy
 
G

Guest

Hi Cor,
It turns out that thhis is actually working correctly, however only if I
have data in the arraylist.
How do I display column headers when there is no data, eg before the
operator has entered any?
 
C

Cor Ligthert

Guy,

I never used this with an arraylist, however when I use a datatable or a
dataview which is empty than the header as named in the
tablestyle.headertext is showed.

I hope this helps somehow.

Cor
 
K

Ken Tucker [MVP]

Hi,

Use ArrayList as the tablestyles mapping name when binding to an
arraylist.

Ken
-----------------
I have a datagrid with tablestyles and columnstyles set up using the
designer, there are 4 columns, bount to 4 of the properties of an object
held
in an arraylist

the binding works fine, the data displaying correctly and is editable,
however the table and columnstyles are ignored when displaying, the grid
just
using the default formatting and displays all properties of the object. I
have checked that the grid has the correct table and columnstyles after
binding.

any ideas where I can look?

guy
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top