All articles| All Pictures| All Softwares| All Video| Go home page| Write articles| Upload pictures

Reading number is top 10 articles
如何使用SQL Server数据库查询累计值_[SQL Server教程]
PHP的strtok()函数实例应用_[PHP教程]
学习SQL2005当中的例子_mssql学习_编程技术
.net开发投票机的思路_.net资料_编程技术
c#判断数据NULL值的方法_[Asp.Net教程]
在.net,App中集成COM组件的一些简单技巧_.net资料_编程技术
Session丢失原因与解决方案小结_[Asp.Net教程]
滑动展开/收缩广告代码实例效果_JavaScript技术_编程技术
PHP对GB编码动态转UTF-8编码的几种方法评测_[PHP教程]
C#使用foreach来读取记录_[Asp.Net教程]
Reading number is top 10 pictures
The money of more than 100 countries and regions13
泳装名模阿尔贝特妮写真
HongMenYan premiere XinLiangGong clairvoyant outfit PK YiFeiLiu2
支持判处贩卖儿童者死刑
姑娘手慢了,已经走光了
这只猪到底犯了什么错?
A man's favorite things15
这才是真正的人体艺术1
The mother was a stay-at-home children too tired took three baby suicide
BingBingFan apple dew point photo gallery4
Download software ranking
虚拟机5.5.3版
SP4 for SQL2000
Boxer's Top ten classic battle8
Desire a peach blossom
Boxer's Top ten classic battle6
Tram sex maniac 2 (H) rar bag2
软件工程思想
The king of fighters 97(Mobile phone games-apk)
Popkart Cracked versions Mobile phone games
Tram sex maniac 2 (H) rar bag6
归海一刀 published in(发表于) 2014/1/30 1:17:13 Edit(编辑)
Asp.net,MVC2.0初级教程-显示列表和内容页_[Asp.Net教程]

Asp.net,MVC2.0初级教程-显示列表和内容页_[Asp.Net教程]

Asp.net MVC2.0初级教程-显示列表和内容页_[Asp.Net教程]
使用Asp.net MVC2.0实现新闻清单的展示和新闻详细页面。

创建View视图Index和NewsDetails


创建新闻首页,用来显示新闻列表。


在Views/News目录下,单击右键,选择Add->View,修改相关配置如下图所示



在生成的HTML代码中,进行相关展示方面的修改。主要代码如下:
<% foreach (var item in Model) { %>




<%: Html.ActionLink("Edit", "NewsEdit", new { id=item.Id }) %> |
<%: Html.ActionLink("Details", "NewsDetails", new { id=item.Id })%> |
<%: Html.ActionLink("Delete", "Delete", new { /* id=item.PrimaryKey */ })%>




<%: item.Title %>




<%: String.Format("{0:g}", item.CreateTime) %>




<%: item.Content %>




<% } %>


使用Foreach循环遍历新闻List中的记录。


<%: Html.ActionLink("Details", "NewsDetails", new { id=item.Id })%> 此连接URL会寻找当前Controller下的NewsDetails Action方法,以新闻编号Id为参数进行传值。



添加到del.icio.us 添加到新浪ViVi 添加到百度搜藏 添加到POCO网摘 添加到天天网摘365Key 添加到和讯网摘 添加到天极网摘 添加到黑米书签 添加到QQ书签 添加到雅虎收藏 添加到奇客发现 diigo it 添加到饭否 添加到飞豆订阅 添加到抓虾收藏 添加到鲜果订阅 digg it 貼到funP 添加到有道阅读 Live Favorites 添加到Newsvine 打印本页 用Email发送本页 在Facebook上分享


Disclaimer Privacy Policy About us Site Map

If you have any requirements, please contact webmaster。(如果有什么要求,请联系站长)
Copyright ©2011-
uuhomepage.com, Inc. All rights reserved.