indenting text in a datagrid

S

Scott Brookhart

I have a grid where I am returning text in a column, then values for that
row.. and the data is hierarchical.
For example something like:
Products Price
Dairy
milk $1.50
yogurt &.75
I want to be able to have based on the example Dairy not indented, but milk
and yogurt indented. when I return the text from the database, all of the
text lines up left, I have tried to add spaces to the indented parts, but
the text still lines up left.
Does anyone have any suggestions how to get spaces into the grid before the
text?
Thanks,
 
J

Jim Ross [MVP]

Just adding spaces won't create an indent unless you make them
nonbreaking spaces ( ) For a better solution, you could handle
ItemCreated for the grid and add an indent style to the items you want
to indent.

Scott Brookhart said:
I have a grid where I am returning text in a column, then values for that
row.. and the data is hierarchical.
For example something like:
Products Price
Dairy
milk $1.50
yogurt &.75
I want to be able to have based on the example Dairy not indented, but milk
and yogurt indented. when I return the text from the database, all of the
text lines up left, I have tried to add spaces to the indented parts, but
the text still lines up left.
Does anyone have any suggestions how to get spaces into the grid before the
text?
Thanks,

Jim Ross
MS MVP [ASP.NET][VC/MFC emeritus]

To send email, change 'lotsofspamthroughhere' to 'msn' but please ask all questions in the newsgroups, not via private mail
 
S

Scott Brookhart

Jim,
Thanks for response.
The datagrid values are coming from a SQL Server table.
I wanted to add   to the text values in the table and return it to the
datagrid, but that does not seem to be working. I will look at the
itemcreated event as you suggest.
Thanks,
Scott Brookhart


Jim Ross said:
Just adding spaces won't create an indent unless you make them
nonbreaking spaces ( ) For a better solution, you could handle
ItemCreated for the grid and add an indent style to the items you want
to indent.

Scott Brookhart said:
I have a grid where I am returning text in a column, then values for that
row.. and the data is hierarchical.
For example something like:
Products Price
Dairy
milk $1.50
yogurt &.75
I want to be able to have based on the example Dairy not indented, but milk
and yogurt indented. when I return the text from the database, all of the
text lines up left, I have tried to add spaces to the indented parts, but
the text still lines up left.
Does anyone have any suggestions how to get spaces into the grid before the
text?
Thanks,

Jim Ross
MS MVP [ASP.NET][VC/MFC emeritus]

To send email, change 'lotsofspamthroughhere' to 'msn' but please ask all
questions in the newsgroups, not via private mail
 

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

Members online

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,902
Latest member
Elena68X5

Latest Threads

Top