.NET 列出数据库的活跃链接

2015-10-27 0 493
.NET 列出数据库的活跃链接
//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/Basic .NET 列出数据库的活跃链接 http://www.ox520.com/13529.html

常见问题

相关文章

发表评论
暂无评论
官方客服团队

为您解决烦忧 - 24小时在线 专业服务