本文实例讲述了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>
您可能感兴趣的文章:
- 一句话木马入侵EASYNEWS新闻管理系统
- JSP一句话木马代码
- asp.net jscript 一句话木马
- asp一句话木马原理分析
- asp,php一句话木马整理方便查找木马
- 一句话木马的原理及利用分析(asp,aspx,php,jsp)
- asp实现读取数据库输出json代码
- 浅谈ASP数据库下载漏洞
- MySQL结合使用数据库分析工具SchemaSpy的方法
- ASP通过ODBC连接SQL Server 2008数据库的方法
- asp.net上传文件到数据库的解决方案
- ASP语言实现对SQL SERVER数据库的操作
- asp控制xml数据库的经典代码
- ASP网站中数据库被挂木马的解决方案
声明:本站(华域联盟www.cnhackhy.com)所有文章,如无特殊说明或标注,均为本站原创发布。任何个人或组织,在未征得本站同意时,禁止复制、盗用、采集、发布本站内容到任何网站、书籍等各类媒体平台。如若本站内容侵犯了原著者的合法权益,可联系我们进行处理。

评论(0)