产品使用及交流论坛

注册

 

QQ登录

只需一步,快速开始

发新话题 回复该主题

[分享]首页新闻标题滚动 [复制链接]

1#
希望在首页的新闻模块里,文章列表能上下滚动。
我是这么做的:
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 (, 下载次数:0)

(2014/1/8 15:32:45 上传)

新增滚动模型-2.jpg

分享 转发
TOP
2#

动了,动了,哈哈哈哈哈!!!
把显示信息数改成6就可以了,同时为了美观,把高度改为150
很开心啊,分享一下。
TOP
3#

好贴,试用了一下
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


出现以上错误,这是什么个情况
TOP
4#

虽然我已经做好了,但还是建议这类贴子加精,对分享自己成功经验的一种鼓励
安庆市人民路小学  www.aqrmlxx.com
TOP
5#

赞同
TOP
发新话题 回复该主题