千羽网络 - 2014/1/8 15:00:56
希望在首页的新闻模块里,文章列表能上下滚动。
我是这么做的:
1、自定义表单中新增模型“文章列表(滚动)”


2、模型设置的“内容区”代码是这样的:
<ul id="n_<%=Module_Id%>" style="height:150px;" class="article"><%
DataTable dt=Get_Data();
DataRow dr;
for(int i=0;i<dt.Rows.Count;i++)
{
dr=dt.Rows
;
%> <li> <span class="title">
<a href="<%=Detail_Url(dr)%>" target="<%=Target%>" title="<%=Server.HtmlEncode(dr["title"].ToString())%>"><%=SubStr(dr["title"].ToString(),Title_Num,true)%></a></span>
<span class="date"><%=((DateTime)dr["thedate"]).ToString("yy-MM-dd")%></span>
<span class="clear"></span>
</li>
<%
}
%></ul>
<script type="text/javascript">
new Marquee("n_<%=Module_Id%>","top",1,null,null,60,null,null,1000);
</script>
3、在首页-模块设置里选择了”文章列表(滚动):


附件: 新增滚动模型-2.jpg
千羽网络 - 2014/1/8 15:29:57
动了,动了,哈哈哈哈哈!!!
把显示信息数改成6就可以了,同时为了美观,把高度改为150
很开心啊,分享一下。
fpbeijing2008 - 2014/1/16 20:29:42
好贴,试用了一下
Compilation Error
Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.
Compiler Error Message: CS0029: Cannot implicitly convert type 'System.Data.DataRowCollection' to 'System.Data.DataRow'
Source Error:
Line 14: for(int i=0;i<dt.Rows.Count;i++)
Line 15: {
Line 16: dr=dt.Rows;
Line 17: %> <li> <span class="title">
Line 18: <a href="<%=Detail_Url(dr)%>" target="<%=Target%>" title="<%=Server.HtmlEncode(dr["title"].ToString())%>"><%=SubStr(dr["title"].ToString(),Title_Num,true)%></a></span>
Source File: c:\Inetpub\wwwroot\whpa\e\zdymodel\article\module\135.ascx Line: 16
出现以上错误,这是什么个情况
lxt0556 - 2014/1/17 10:56:11
虽然我已经做好了,但还是建议这类贴子加精,对分享自己成功经验的一种鼓励
waynewangep - 2014/1/17 12:52:17
:)赞同