Hello Telerik Team,
i am developing a solution in which user adds his defined columns to the gridview and the number of columns not limited to some number, there may be 'n' number of columns, my question is when user gives a very long text for the header , i want to wrap the text to some confined width in the header
i wonder there is no vertical stretch to header ,i tried bestFit, autosize everything but unable to find the answer
i want to wrap the header text something like below, is this possible ?????
can you please help me out
i am developing a solution in which user adds his defined columns to the gridview and the number of columns not limited to some number, there may be 'n' number of columns, my question is when user gives a very long text for the header , i want to wrap the text to some confined width in the header
i wonder there is no vertical stretch to header ,i tried bestFit, autosize everything but unable to find the answer
can you please help me out
5 Answers, 1 is accepted
0
Hello Lakshmi,
Thank you for writing.
You can achieve the desired behavior through subscribing to the ViewCellFromating event of the RadGridView and setting the TextWrap property to true. For example:
This topic is also discussed in the following forum thread: http://www.telerik.com/community/forums/winforms/gridview/how-to-wrap-text-only-in-header-cell.aspx
I hope this helps. If you have further questions, feel free to write back.
Regards,
Anton
the Telerik team
Thank you for writing.
You can achieve the desired behavior through subscribing to the ViewCellFromating event of the RadGridView and setting the TextWrap property to true. For example:
this
.radGridView1.ViewCellFormatting +=
new
Telerik.WinControls.UI.CellFormattingEventHandler(radGridView1_ViewCellFormatting);
void
radGridView1_ViewCellFormatting(
object
sender, Telerik.WinControls.UI.CellFormattingEventArgs e)
{
if
(e.CellElement
is
GridHeaderCellElement)
{
e.CellElement.TextWrap =
true
;
}
}
This topic is also discussed in the following forum thread: http://www.telerik.com/community/forums/winforms/gridview/how-to-wrap-text-only-in-header-cell.aspx
I hope this helps. If you have further questions, feel free to write back.
Regards,
Anton
the Telerik team
Q3'12 SP1 of RadControls for WinForms is out now. See what's new.
0
Sree
Top achievements
Rank 1
answered on 03 Jan 2013, 01:39 AM
Hello Team,
thanks it working perfect :)
thanks it working perfect :)
0
RIZAL
Top achievements
Rank 1
answered on 24 Feb 2016, 01:20 AM
Hi, is this code is still relevant for release 2016.1.216.40?
How to proceed in vb code?
Thank you.
0
Hello Rizal,
Thank you for writing.
The code snippet is still applicable for the latest version. Here is the snippet in VB:
Feel free to use our online converter from C# to VB.NET and vice versa: http://converter.telerik.com/
I hope this information helps. Should you have further questions I would be glad to help.
Regards,
Dess
Telerik
Thank you for writing.
The code snippet is still applicable for the latest version. Here is the snippet in VB:
Private
Sub
RadGridView1_ViewCellFormatting(sender
As
Object
, e
As
Telerik.WinControls.UI.CellFormattingEventArgs) _
Handles
RadGridView1.ViewCellFormatting
If
TypeOf
e.CellElement
Is
GridHeaderCellElement
Then
e.CellElement.TextWrap =
True
End
If
End
Sub
Feel free to use our online converter from C# to VB.NET and vice versa: http://converter.telerik.com/
I hope this information helps. Should you have further questions I would be glad to help.
Dess
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
RIZAL
Top achievements
Rank 1
answered on 25 Feb 2016, 01:44 AM
Hi Dess,
Thank you, it works perfectly.