Wrap Long Text Inside the Gridview Column

  1. <html>  
  2. <head runat="server">  
  3.     <style type="text/css">  
  4.         .WrapText {  
  5.             width: 100%;  
  6.             word-break: break-all;  
  7.         }  
  8.     </style>  
  9. </head>  
  10. <body>  
  11.     <form id="form1" runat="server">  
  12.         <div class="WrapText">  
  13.             <asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager>  
  14.             <asp:GridView ID="MyGrid" runat="server" AutoGenerateColumns="False" DataKeyNames="First_Name"  
  15.                 ForeColor="#333333" GridLines="Both" Width="50%">  
  16.                 <AlternatingRowStyle BackColor="White" />  
  17.                 <Columns>  
  18.                     <asp:BoundField HeaderText="FirstName" DataField="First_Name">  
  19.                         <ItemStyle Width="35" />  
  20.                         <HeaderStyle Width="100px" />  
  21.                     </asp:BoundField>  
  22.                     <asp:BoundField HeaderText="LastName" DataField="Last_Name">  
  23.                         <ItemStyle Width="50" />  
  24.                         <HeaderStyle Width="100px" />  
  25.                     </asp:BoundField>  
  26.                 </Columns>  
  27.             </asp:GridView>  
  28.         </div>  
  29.     </form>  
  30. </body>  
  31. </html>