发布于 2016-06-14 11:25:28 | 136 次阅读 | 评论: 0 | 来源: 网友投递
ASP.NET
ASP.NET 是.NET FrameWork的一部分,是一项微软公司的技术,是一种使嵌入网页中的脚本可由因特网服务器执行的服务器端脚本技术,它可以在通过HTTP请求文档时再在Web服务器上动态创建它们。 指 Active Server Pages(动态服务器页面) ,运行于 IIS(Internet Information Server 服务,是Windows开发的Web服务器)之中的程序 。
本文实例讲述了ASP.NET列出数据库活跃链接的方法。分享给大家供大家参考。具体分析如下:
这里列出数据库的活跃链接。主要使用geeric列表和一个贮存器,创建一个泛型列表的链接,如果他们是活跃的,那么他们将显示在导航了。
//First in C# where you create the controller action method
//to create the method that will populate all content details
//add the following code
public ActionResult Details(int id)
{
var repositoryList = _repository.List();
ViewData["List"] = repositoryList;
return View(_repository.Get(id));
}
<!--now is ASP.net add the following in your navigation panel->
<ul>
<% foreach (var item in (List<Service>)ViewData["List"])
{%>
<% if ((item.isActive) || (item.id != 0))
{ %><li><%=Html.ActionLink(item.Title, "Details", new { id = item.id })%></li><%} %>
<%} %>
</ul>
希望本文所述对大家的asp.net程序设计有所帮助。