DataGrid and Tablestyles

N

nevin

Hiya,

I have a table which without any tablestyles and associated columns displays
all the columns of the table as you would expect.
If I add a tablestyle and one column which I then add the TableStyle to the
grid no columns at all show. This grid is visible and i can see the current
position in the grid and the insertion point in the left column but my added
style and it's column don't show. The column is not null, has a wide width
and a column header which is set to visible=true.

//setup command and dataadapter etc..removed for brevity
System.Data.DataSet ds = new DataSet("T_Data");
da.Fill(ds, "T_Data");
grdData.DataSource = ds.Tables["T_Data"];
grdData.Visible = ds.Tables[0].Rows.Count > 0?true:false;
dgstyle1.MappingName = "T_Data";
grdData.TableStyles.Add(dgstyle1);


dgstyle1 is obviously the TableStyle which is added in VSNET's designer and
the column which has a mapping name to the one of the columns in the table
was also added through the designer. I've also tried doing it manually as
well but it's exactly the same!

Removing the last 2 lines will show the entire table as in all the columns
and the column names as the titles. This was working fine until I changed
the Dock style of the grid, undid it and bam...it refused to work. I've
since removed the entire grid and put it all back in again but I still
cannot get the columns to show when I have a TableStyle applied.
I have already pulled all my hair out so to save me starting on my chest and
then...I don't even want to think about it. So please help!

Nev
 
N

nevin

ok I've worked it out finally, it was me and the column names I was using
(mapping names on the columns) I had them back to front so it wasn't
matching anything..doh.
thank God, as the hair pulling was getting painfull.
 

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