Help: ASP.NET GRIDVIEW problem

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
 
G

Guest

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,770
Messages
2,569,583
Members
45,072
Latest member
trafficcone

Latest Threads

Top