Wrap text in gridview column

By Mash B

Wrapping up the continuous text in gridview column

On RowDataBound event of gridview write below line of code

protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)

{

  if (e.Row.RowType == DataControlRowType.DataRow)

  {

    e.Row.Cells[4].Attributes.Add("style", "word-break:break-all;word-wrap:break-word");

    //Where Cells[4] - is cell number which u want to format

  }
}

Wrap text in gridview column  (1095 Views)