Help: ASP.NET GRIDVIEW problem

  • Thread starter Thread starter Progman
  • Start date Start date
P

Progman

I save comments including its carriage-return linefeed from an ASP.NET
textbox to a Varchar(200) field in an SQL Server Database.

I show these records in an ASP.NET gridview with other columns (nae, city,
country, etc). The comment appears on one row.

How can I get multiline in a gridview. I found no properties associated with
the gridview to do that.

Should I use a textbox instead of a bounfield?

I tried a textbox and I got a strange error message and it was suggesting
that I use a bounfield.

txs to answer
 
Hi Progman,

Try following code in GridView_RowDataBound event

string comment = e.Row.Cells[col_index].Text;
e.Row.Cells[col_index].Text = comment.Replace(System.Environment.NewLine,
"<br>");

HTH

Elton Wang
 
Back
Top