Last post Jul 06, 2010 06:45 PM by muhibd85
Jun 02, 2009 02:26 PM|mohsenAmani|LINK
I put a gridview in a asp.net page.I connect to access and get data.Data can be shown in grid without any error.But I want to resize the Gridview header so that contents(data) fit in gridview cells in a line without wrap. I test wrap propertt and set Wrap
to "false".but I does not work.I write a function to compute data length in any cell and set cell width based on it.is there any simple way?my friend said to (win-app datagrid) has a "Autofit" propery but web-app grid view hasn't this property.
is there any simple way to Autofit cells in grid view?
please leave your ideas and answers even they are simple or funny.
Jun 02, 2009 03:57 PM|RatheeshC|LINK
Try to apply this style "white-space: nowrap;" in the cell..
Jun 02, 2009 03:59 PM|nmadd|LINK
You could add the "white-space:nowrap" style to each GridView cell in the RowDataBound event. There is perhaps a better way, but I know at least this works.
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
for (int i = 0; i < e.Row.Cells.Count; i++)
Jul 06, 2010 06:45 PM|muhibd85|LINK
i. This really works. I found it after searching alot for the solution. Thanks. H