Wednesday, 18 April 2012

how to wrap text in radgrid's column or label without space

CSS Class :-

.breakWord120
{
   max-width: 120px !important;
   word-break: break-all !important;
   word-wrap: break-word !important;
   vertical-align: top;
   line-height: 15px;
}

How to use in RadGrid.
<telerik:GridBoundColumn DataField="Name" HeaderText="Name" UniqueName="Name" ItemStyle-CssClass="breakWord120"></telerik:GridBoundColumn>
How To Use In Label.
<asp:Label ID="Label1" runat="server" CssClass="breakWord120"></asp:Label>
By above example you can able to break the RadGrid's column or any Label if their text width exceed the 120px.
Note : It worked on both cases is space is available (in text/content) or not.