Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

datagrid tablestyles and integer columns

47 views
Skip to first unread message

Markus

unread,
Mar 18, 2005, 2:59:04 PM3/18/05
to
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


Arun

unread,
Mar 20, 2005, 11:22:22 PM3/20/05
to
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

Markus

unread,
Mar 25, 2005, 9:05:05 AM3/25/05
to
thanks arun, that´s it :-)

(weird compact framework)

0 new messages