Pages

Wednesday, 23 May 2012

Fixing the gridview column width for long string values without spaces

If your grid column contains data string values that does not have any spaces, just setting the grid and column width wont work. When the data is loaded , the width of the grid as well the column exceeds the set value. To make sure it works.
  1. Set the desired width for each column and the grid.
  2. Add below line in the page load event of your page
    gridview.Attributes.Add("style", "word-break:break-all;word-wrap:break-word");

1 comment:

  1. thanks..this is very helpful to me..............

    ReplyDelete