如何在mvc中显示gridview [英] How do I display a gridview in mvc
问题描述
我是mvc的新手,我试图显示一个gridview,但似乎有问题,这就是我的尝试
0725579221a@gmail.commodel IEnumerable< clinicsystem.model.vitalmediciceview>
@using GridMvc
@using GridMvc.Html
< chunk style =font-family:Times; font-weight:bold;>日期:
< chunk style =font-family:Times; > @ DateTime.Now.ToString(MM:dd:yyyy)
Hi Im new to mvc and im trying to display a gridview but it seems to be having problems, This is what I have tried
0725579221a@gmail.commodel IEnumerable<clinicsystem.model.vitalmediciceview>
@using GridMvc
@using GridMvc.Html
<chunk style="font-family: Times; font-weight: bold;">Date:
<chunk style="font-family: Times;">@DateTime.Now.ToString("MM:dd:yyyy")
< chunk style =font-family:Times; font-weight:bold;>时间:
< chunk style =font-family:Times;> @ DateTime.Now.ToString (hh:mm:ss tt zz)
<chunk style="font-family: Times; font-weight: bold;">Time:
<chunk style="font-family: Times;">@DateTime.Now.ToString("hh:mm:ss tt zz")
Medicines List : @Model.Count()
@ Html.ActionLink(添加新药,创建)
@Html.ActionLink("Add New Medicine", "Create")
@ Html.Grid(型号).Columns(columns =>
{
columns.Add()。标题(查看)。编码(false).Sanitized(false).RenderValueAs(c => @ Html.ActionLink(Details,Details,new {id = c.MedeId}));
columns.Add()。标题(删除)。编码(false)。 Sanitized(false).RenderValueAs(c => @ Html.ActionLink(Delete,Delete,new {id = c.MedeId}));
columns.Add()。标题(请求)。编码(false).Sanitized(false).RenderValueAs(c => @ Html.ActionLink(请求,编辑,新{id = c.MedeId}));
})。WithPaging(20).Sortable(true)
@Html.Grid(Model).Columns(columns =>
{
columns.Add().Titled("View").Encoded(false).Sanitized(false).RenderValueAs(c => @Html.ActionLink("Details ", "Details", new { id = c.MedeId }));
columns.Add().Titled("Remove").Encoded(false).Sanitized(false).RenderValueAs(c => @Html.ActionLink("Delete", "Delete", new { id = c.MedeId }));
columns.Add().Titled("Request").Encoded(false).Sanitized(false).RenderValueAs(c => @Html.ActionLink("Request", "Edit", new { id = c.MedeId }));
}).WithPaging(20).Sortable(true)
提前致谢。
Thanks in advance.
推荐答案
columns.Add(c => c.Name).Titled("Medicine Name").Filterable(true);
columns.Add(c => c.putyourproparties).Titled("Medicine Description").Filterable(true);
columns.Add(c => c.putyourproparties).Titled("Quantity").Filterable(true);
columns.Add(c => c.putyourproparties).Titled("Available").Filterable(true);
columns.Add(c => c.putyourproparties).Titled("Medicine Expiry Date");
创建后你应复制并粘贴此代码,这条红线表示你应该从类中编写变量
after create u should copy and paste this code, this red lines it means you should write your variables from your class
这篇关于如何在mvc中显示gridview的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!