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.

15 comments:

  1. it doesn't work

    ReplyDelete
  2. Can you please provide your code? So, I will try to resolve your issue.

    ReplyDelete
  3. Hi this works great, thanks for the Post.

    ReplyDelete
  4. telerik:GridTemplateColumn Display="true" UniqueName="Activity" HeaderText="Indicate F if Financial Activity">









    .clsActivityHeader
    {
    max-width:2px !important;
    word-break: break-all !important;
    word-wrap: break-word !important;
    vertical-align: top;
    line-height: 5px;
    }



    im not getting a line break in the header ..what must i do?

    ReplyDelete
    Replies
    1. HeaderStyle CssClass="clsActivityHeader" Font-Bold="true"
      temStyle CssClass="clsActivity"
      I have added like this...please give me some inputs

      Delete
    2. Please try with the below code snippet.

      HeaderStyle CssClass="clsActivityHeader" Width="2px"

      Delete
  5. Thanks Jayesh, its working fine.

    ReplyDelete
  6. Thanks Jayesh, its working fine for me.

    ReplyDelete
  7. Thanks Jayesh, worked for me!!

    ReplyDelete
  8. Excelent, it's working!

    ReplyDelete
  9. Great workaround Jayesh, appreciate your efforts in blogging such tricks. Very helpful.

    ReplyDelete
  10. It worked. Thank you Jayesh for sharing.

    ReplyDelete
  11. Great it worked!!!Thanks a lot...

    ReplyDelete
  12. Perfect. It resolved my issue. Thanks for posting

    ReplyDelete