Datagrid Truncates Data?

  • Thread starter Thread starter Sean
  • Start date Start date
S

Sean

I am using a datagrid to display some data. I notice when
I click in a cell where the data is longer than the cell
width, it truncates the end of the data off.

For example:

The data is:
This is sample data

Column only has room for:
This is sample da

When I click in the cell, it changes to:
This is sample

When I leave the cell, it changes back to:
This is sample da

Is this a property of the DataGridTableStyle? Can I fix it
so that when I click in the cell, all the data is there if
I right arrow over? Thanks.

Sean
 
Erm, this is a thorny issue. Basically there is no AutoWidth facility. You
need to measure the text you have in there and set the column width to be
wide enough to display it. It's cr*p I know.

But, there are third party grids out there which do this sort of thing.

Regards - OHM
 
Mr.Ken Tucker taught about allowing word wrap to occur inside a cell. Since
doing this, I have not had these issues.

If he does not respond I will see if I can dig it up from memory.
 
Useful, yes, but this is not the answer really is it. If you were using a
spreadsheet, you would not necessarily want wrapping to happen. The OP wants
truncation to stop, not wrapping to begin. ( At least I think as much ).

Regards - OHM
 
I am wondering if the truncation is occuring at the database level or if
somehow the code iteself is truncating the data. For instance if the dataset
field has a max of 50 chararacters and the database has a max of 100 the
grid will cut off the 50 the database tries to deliver.

I may be wrong though because now that I think about it it should throw a
concurrency error.
 
The data is correct in the database. The truncation seems
to be to the nearest full word at the physical level, and
only while the cell is selected.

For example, If my data was:

Alpha ABCDEFGHIJKLMNOPQRSTUVWXYZ

And only this much fits physically in the grid cell:

Alpha ABCDEFGHIJKLMNOPQRSTUVW

When I click in the cell I get:

Alpha

And when I click off again I get:

Alpha ABCDEFGHIJKLMNOPQRSTUVW



-----Original Message-----
I am wondering if the truncation is occuring at the database level or if
somehow the code iteself is truncating the data. For instance if the dataset
field has a max of 50 chararacters and the database has a max of 100 the
grid will cut off the 50 the database tries to deliver.

I may be wrong though because now that I think about it it should throw a
concurrency error.

"One Handed Man [ OHM# ]" <O_H_M{at}BTInternet{dot}com> wrote in message
Useful, yes, but this is not the answer really is it.
If you were using
a
spreadsheet, you would not necessarily want wrapping to
happen. The OP
wants
truncation to stop, not wrapping to begin. ( At least I think as much ).

Regards - OHM
Mr.Ken Tucker taught about allowing word wrap to occur inside a cell.
Since doing this, I have not had these issues.

If he does not respond I will see if I can dig it up from memory.

"One Handed Man [ OHM# ]" <O_H_M{at}BTInternet{dot} com> wrote in
message [email protected]...
Erm, this is a thorny issue. Basically there is no AutoWidth
facility. You need to measure the text you have in there and set the
column width to be wide enough to display it. It's cr*p I know.

But, there are third party grids out there which do this sort of
thing.

Regards - OHM


Sean wrote:
I am using a datagrid to display some data. I notice when
I click in a cell where the data is longer than the cell
width, it truncates the end of the data off.

For example:

The data is:
This is sample data

Column only has room for:
This is sample da

When I click in the cell, it changes to:
This is sample

When I leave the cell, it changes back to:
This is sample da

Is this a property of the DataGridTableStyle? Can I fix it
so that when I click in the cell, all the data is there if
I right arrow over? Thanks.

Sean


.
 
The reason for this is that when you edit a cell, it puts an edit box over
the cell you are editing. When you are not, it resorts to the column width.
You need to use styles for the column and measure the width of the text.

This is a common topic on the web. Use google to find something suitable.


Regards - OHM

The data is correct in the database. The truncation seems
to be to the nearest full word at the physical level, and
only while the cell is selected.

For example, If my data was:

Alpha ABCDEFGHIJKLMNOPQRSTUVWXYZ

And only this much fits physically in the grid cell:

Alpha ABCDEFGHIJKLMNOPQRSTUVW

When I click in the cell I get:

Alpha

And when I click off again I get:

Alpha ABCDEFGHIJKLMNOPQRSTUVW



-----Original Message-----
I am wondering if the truncation is occuring at the database level
or if somehow the code iteself is truncating the data. For instance
if the dataset field has a max of 50 chararacters and the database
has a max of 100 the grid will cut off the 50 the database tries to
deliver.

I may be wrong though because now that I think about it it should
throw a concurrency error.

One Handed Man said:
Useful, yes, but this is not the answer really is it. If you were
using a spreadsheet, you would not necessarily want wrapping to
happen. The OP wants truncation to stop, not wrapping to begin. (
At least I think as much ).

Regards - OHM

scorpion53061 wrote:
Mr.Ken Tucker taught about allowing word wrap to occur inside a
cell. Since doing this, I have not had these issues.

If he does not respond I will see if I can dig it up from memory.

"One Handed Man [ OHM# ]" <O_H_M{at}BTInternet{dot} com> wrote in
message [email protected]...
Erm, this is a thorny issue. Basically there is no AutoWidth
facility. You need to measure the text you have in there and set
the column width to be wide enough to display it. It's cr*p I
know.

But, there are third party grids out there which do this sort of
thing.

Regards - OHM


Sean wrote:
I am using a datagrid to display some data. I notice when
I click in a cell where the data is longer than the cell
width, it truncates the end of the data off.

For example:

The data is:
This is sample data

Column only has room for:
This is sample da

When I click in the cell, it changes to:
This is sample

When I leave the cell, it changes back to:
This is sample da

Is this a property of the DataGridTableStyle? Can I fix it
so that when I click in the cell, all the data is there if
I right arrow over? Thanks.

Sean


.
 
Hi Ken,
I have not visited the link yet, but does this also deal with
auto column width ?

Regards - OHM
 
Hi,

Not yet.

Ken
--------------------
One Handed Man said:
Hi Ken,
I have not visited the link yet, but does this also deal with
auto column width ?

Regards - OHM
 
Back
Top