TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Abby
NA
9
0
New Line in GridView cell
May 18 2008 6:42 AM
Hi. I am working on a school project and I want a new line in a cell. I tried using <br>, \n, and Environment.NewLine but nothing works.
I have my grid code in a class:
public DataTable quoteorder(order ord, int index) //show in grid
{
DataTable table = new DataTable();
table.Columns.Add("Qty. (pieces)");
table.Columns.Add("Qty. (kilos)");
table.Columns.Add("Description");
table.Columns.Add("Print");
table.Columns.Add("Print Color");
table.Columns.Add("Hole");
table.Columns.Add("Price");
int x = 0;
//String num = "";
while (x < index)
{
//num = sale.getStockID(x);
DataRow row = table.NewRow();
row["Qty. (pieces)"] = ord.getQtypcs2(x);
row["Qty. (kilos)"] = ord.getQtykgs2(x);
row["Description"] = ord.getProdtype2(x);
row["Print"] = ord.getPrint2(x) +" - " + ord.getPrint12(x);
row["Print Color"] = ord.getPcolor2(x);
row["Hole"] = ord.getHoles2(x) + " - " + ord.getHoles12(x);
row["Price"] = ord.getPrice2(x);
table.Rows.Add(row);
x++;
}
return table;
}
Instead of having 7 columns, I want the data in
the follwing columns:
table.Columns.Add("Print");
table.Columns.Add("Print Color");
table.Columns.Add("Hole");
table.Columns.Add("Price");
under the Description column. That's why I need to have a new line like this:
row["Description"] = ord.getProdtype2(x)+
NEW LINE
+ord.getPrint2(x) +" - " + ord.getPrint12(x);
but I can't make <br> work. If I put <br> and run my program, it displays "<br>" in the grid.
The grid is called in the pageload using this code:
order.DataSource = ord.quoteorder(ord, index);
order.DataBind();
Can anyone help me on this?
Reply
Answers (
11
)
Richt Text Box with numbered lines
HELP Loading a Class Property from a DataRow