问题描述
利用DHTMLX和MVC写了一个程序···已经在view中得到database中的数据了··代码如下:Data.cshtml:@*@modelPloos.SOA.Frontend.Core.Models.Subscription.Location*@@modelIEnumerable<Ploos.SOA.Frontend.Core.Models.Subscription.Location>@{ViewBag.Title="Data";}<h2>Data</h2>@foreach(variteminModel){<tr><td>@Html.DisplayFor(modelItem=>item.locationId)</td><td>@Html.DisplayFor(modelItem=>item.locationRevision)</td><td>@Html.DisplayFor(modelItem=>item.name)</td><td>@Html.DisplayFor(modelItem=>item.ParentLocationID)</td><th>@Html.DisplayFor(modelItem=>item.ParentLocationRevision)</th><th>@Html.DisplayFor(modelItem=>item.locationLevelID)</th><th>@Html.DisplayFor(modelItem=>item.Remarks)</th><th>@Html.DisplayFor(modelItem=>item.removed)</th><th>@Html.DisplayFor(modelItem=>item.date)</th><th>@Html.DisplayFor(modelItem=>item.NvString)</th><th>@Html.DisplayFor(modelItem=>item.UserID)</th><th>@Html.DisplayFor(modelItem=>item.CfvID)</th><th>@Html.DisplayFor(modelItem=>item.IsActive)</th><th>@Html.DisplayFor(modelItem=>item.locationTypeID)</th><th>@Html.DisplayFor(modelItem=>item.LocationCode)</th><th>@Html.DisplayFor(modelItem=>item.locationStatus)</th>@*<td>@Html.ActionLink("Edit","Edit",new{id=item.locationId})|@Html.ActionLink("Details","Details",new{id=item.locationId})|@Html.ActionLink("Delete","Delete",new{id=item.locationId})</td>*@</tr>}测试过了··可以得到database数据问题是··我想让它显示在页面上的grid里··grid代码如下:vargrid2=layout.cells("d").attachGrid();grid2.setHeader("ID,Revision,ParentID,ParentRevision,Name,LocationLevelID,Remarks,Removed,Date,NvString,UserID,CfvID,IsActive,locationTypeID,LocationCode,LocationStatus");//setstheheadersofcolumnsgrid2.setColumnIds("id,revision,parentId,parentRevision,name,locationLevelId,remarks,removed,date,nvstring,userID,cfvId,isActive,locationTypeID,locationCode,locationStatus");//setsthecolumns'idsgrid2.attachHeader("#numeric_filter,#numeric_filter,#numeric_filter,#numeric_filter,#text_filter,#numeric_filter,#text_filter,#text_filter,#text_filter,#text_filter,#numeric_filter,#numeric_filter,#text_filter,#numeric_filter,#numeric_filter,#text_filter");grid2.setInitWidths("*");//setstheinitialwidthsofcolumnsgrid2.setColAlign("left,left,left,left,left,left,left,left,left,left,left,left,left,left,left,left");//setsthealignmentofcolumnsgrid2.setColTypes("ro,ro,ro,ro,ro,ro,ro,ro,ro,ro,ro,ro,ro,ro,ro,ro");//setsthetypesofcolumnsgrid2.setColSorting("str,str,str,str,str,str,str,str,str,str,str,str,str,str,str,str");//setsthesortingtypesofcolumnsgrid2.init();要怎么显示出来呢?
解决方案
解决方案二:
就是数据绑定呗?
解决方案三:
引用1楼FoxDave的回复:
就是数据绑定呗?
就是不知道要怎么绑定啊··网上找的都是关于php··xml···json之类的··但我是在.cshtml文件里面得到的数据··所以该怎么写呢?