datagrid tablestyles and integer columns

G

Guest

Hi there,

i know you find a lot about dt styles here, but i´ve got to come up with
another problem.
i want to correct the size of "ID" column (non text format). here´s the code:

adap.fill(ds, "myTab");
dataGrid1.datasource = ds.tables["myTab"];

DataGridTableStyle tabStyle = new DataGridTableStyle();
styleDG.MappingName = "myTab";

DataGridColumnStyle colID = new DataGridColumnStyle();
//tried DataGridTextBoxColumn here - not working!
colID.MappingName = "id";
colID.HeaderText = "ID";
colID.Width = 20;
tabStyle.GridColumnStyles.Add(colID);
dataGrid1.TableStyles.Add(tabStyle);


so, obviously this works fine with all "text" columns but not with integer
or date columns. the id col just disappears. i also thought about using the
convert function (sql), but it looks like this is not supported in CF/sql ce.

thanks in advance.
markus
 
A

Arun

Hi Markus

Try this,

adap.fill(ds, "myTab");
dataGrid1.datasource = ds.tables["myTab"];


DataGridTableStyle tabStyle = new DataGridTableStyle();
styleDG.MappingName = "myTab";

DataGridTextBoxColumn ColID =
new DataGridTextBoxColumn();


colID.MappingName = "id";
colID.HeaderText = "ID";
colID.Width = 20;
tabStyle.GridColumnStyles.Add(colID);

//Add this
dataGrid1.TableStyles.Clear();

dataGrid1.TableStyles.Add(tabStyle);

Hope this helps,

Regards,
Arun.
www.innasite.com
 

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