GridiHeader Resize
Hi,
I want fix the width of the column header according to the text given to the column header with out re sizing the column header manually.
For example if I give the column name "Testing", column header width should adjust according to that. or If I give the column name "Tester Testing" column header width should adjust according to that and display the full text.
How can I achieve that?
Regards
Sasee. G
-
Hello Sasee,
The Column class has the Adjust() method. To fit a column to its best width use the following:
Column column = grid.Headers[0]["yourId"];
column.Adjust(true, true);Best regards,
Dapfor
0 -
Hi Dapfor Team,
My grid has dynamic created columns and I'm using "column.Adjust" method to get auto adjust column width by grid header.
My problems is if the column value is longer than the column header it cannot showing completely. like showing in figure 1:
figure 1 : actual value for Order Price column is 123456.1
I want to get the column display to auto adjust according to data value so that the user can know the data is incomplete
or another way to change the display to some mask data like in excel.
Could you help me advice ? Many thanks in advance .
Have a good day !!
With Regards
Su Myat
0 -
I just attached the picture.
Figure 1 and excel mask data ###.
Thanks
With Regards
Su Myat
order price 1.JPG
excel mask data.JPG0 -
Hello,
You can alter default flags to draw text in cells. The best and easiest way - is to add ellipsis characters, if the text is out of the cell.
grid.PaintCell += delegate(object sender, PaintCellEventArgs e)
{
if(e.Cell.Column != null)
{
e.TextSettings.Trimming = StringTrimming.EllipsisCharacter;
}
};Best regards,
Dapfor
0
Please sign in to leave a comment.
Comments
4 comments