datagrid tablestyles and integer columns

  • Thread starter Thread starter Guest
  • Start date Start date
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
 
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
 
Back
Top