【发布时间】:2014-06-11 18:09:47
【问题描述】:
我在 html 表中显示返回时遇到问题,它返回为一行。
我正在从 sql 2012 数据库中获取数据,但这很奇怪,因为当我在文本区域中编辑数据时,它会显示返回值。
有什么想法吗?
public ActionResult Details(int id = 0)
{
WorkoutModel workoutmodel = db.WorkoutModels.Find(id);
if (workoutmodel == null)
{
return HttpNotFound();
}
return View(workoutmodel.WorkoutDetails.Replace(System.Environment.NewLine, "<br />"));
}
【问题讨论】:
-
设置断点,看看
workoutmodel.WorkoutDetails的值到底是什么 -
Environment.NewLine有时会出现问题。我已经更新了解决方案。
标签: html sql asp.net html-table