ورود

View Full Version : استفاده از کلاس HtmlTable



هورداد
پنج شنبه 15 مرداد 1394, 13:31 عصر
سلام دوستان
من یک HtmlTable ساختم ومی خوام به ویو پاس بدمش .
اما در بروزر تنها پیغام زیر را می بینم :
System.Web.UI.HtmlControls.HtmlTable


کنترلر :


public ActionResult Index()
{
HtmlTable htmlTable1 = new HtmlTable();
for (int i = 0; i < 2; i++)
{

HtmlTableRow rows = new HtmlTableRow(); //a new Row

for (int j = 0; j < 3; j++)
{

HtmlTableCell cell = new HtmlTableCell(); //a new Cell
cell.InnerHtml = i + "," + j; //Insert Data into Cell

cell.Align = "Center";

cell.BorderColor = "Gray";
rows.Cells.Add(cell); //Attach Cell with Row
}
htmlTable1.Rows.Add(rows); //Attach Row with Table
}
ViewBag.tt = htmlTable1;

return View();




View :


<div class="portlet-body">
@Html.Raw(ViewBag.tt)

</div>}


133978