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.

16 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. In this is just a very simple short WordPress tutorial videos tutorial on how to wrap text around a video I've also got a video on this blog post how to read wrap text around an image or a picture very very simple to to wrap text around and imaging WordPress of I've made up a video not put that on this blog post as well that the blog post is actually about how to wrap text around a video so if you don't want to just put the video up the top here you want to put it to the size to the left of the right it's very good very easy but what you need to do is you need to add a bit of code so I've written that code and I've put it in pink here on my site on this on this actual blog post only
    To know more click here

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

    ReplyDelete