repeater怎么使用

问题描述

想弄一个滚动新闻栏,求repeater制作的详细步骤,包括数据库,数据库中表news的字段为NewsID、NewsTitle、NewsContent,只要求显示NewsTitle的滚动效果即可,然后希望点进去能链接到NewsContent,求步骤,和源代码

解决方案

解决方案二:
<divstyle="overflow:hidden;"id="marqueebox"><asp:RepeaterID="rpMarqueeSiteLink"runat="server"><ItemTemplate><divstyle="float:left;"><%#Eval("osaname")%>:</div><br/><divstyle="float:left;text-align:left;"><ahref="<%#Eval("osalinks")%>"target="_blank"><%#Eval("osalinks")%></a></div><br/></ItemTemplate></asp:Repeater></div><spanid="spError"runat="server"/><scripttype="text/javascript"><!--functionstartmarquee(lh,speed,delay){vart;varp=false;varo=document.getElementById("marqueebox");o.innerHTML+=o.innerHTML;o.onmouseover=function(){p=true}o.onmouseout=function(){p=false}o.scrollTop=0;functionstart(){t=setInterval(scrolling,speed);if(!p)o.scrollTop+=2;}functionscrolling(){if(o.scrollTop%lh!=0){o.scrollTop+=2;if(o.scrollTop>=o.scrollHeight/2)o.scrollTop=0;}else{clearInterval(t);setTimeout(start,delay);}}setTimeout(start,delay);}startmarquee(22,50,1000);/**startmarquee(一次滚动高度,速度,停留时间,图层标记);**///--></script>

参考
解决方案三:
效果出不来啊,Thankyouallthesanme
解决方案四:
引用2楼的回复:

效果出不来啊,Thankyouallthesanme

Repeater的用法网上多得是,至于滚动效果,可以借助JS或者Jquery实现
解决方案五:
<marquee>
解决方案六:
……连个div的事情...DIV+CSS实现数据滚动
解决方案七:
请教一下楼上,div+CSS代码怎么设计啊,我是新手,说详细点啦~~
解决方案八:
css文件怎么实现呢?急求指教引用5楼的回复:

……连个div的事情...DIV+CSS实现数据滚动

解决方案九:
第一一个样式的固定高度#dataDiv{OVERFLOW:auto;//滚动区域自动OVERFLOW-X:hidden;//隐藏横坐标滚动条OVERFLOW-Y:hidden;//隐藏纵坐标滚动条HEIGHT:600px;//区域高度WIDTH:600px//区域高度}

解决方案十:
<divid="contentDiv"><divid="titleDiv"><TABLEcellSpacing="0"cellPadding="0"border="1"><TRalign="center"><THwidth="40">序号</TH><THwidth="100">字段名</TH><THwidth="40">类型</TH><THwidth="90">显示区域</TH><THwidth="40">附件</TH><THwidth="60">简表字段</TH><THwidth="40">必填</TH><THwidth="40">排序</TH><THwidth="100">操作</TH></TR></TABLE></div><divid="dataDiv"><TABLEid="listcontent"cellSpacing="0"cellPadding="0"border="1"style="FLOAT:left;MARGIN:0px"><asp:repeaterid="repeaterData"Runat="server"><ItemTemplate><tr><tdstyle="width:40px;"class="btn"><asp:TextBoxID="txtSearch"Runat="server"Text='<%#DataBinder.Eval(Container.DataItem,"sequence")%>'></asp:TextBox></td><tdstyle="width:100px;"><asp:LabelID="Lbl_Id"Runat="server"Text='<%#DataBinder.Eval(Container.DataItem,"id")%>'Visible="False"></asp:Label><%#DataBinder.Eval(Container.DataItem,"name")%>&nbsp;</td><tdstyle="width:40px;"><asp:LabelID="Lbl_Type"Runat="server"Text='<%#DataBinder.Eval(Container.DataItem,"fieldType")%>'></asp:Label><asp:HyperLinkID="link_manager"Runat=server>选项</asp:HyperLink>&nbsp;</td><tdstyle="width:90px;"><asp:LabelID="Lbl_Area"Runat="server"Text='<%#DataBinder.Eval(Container.DataItem,"area")%>'></asp:Label>&nbsp;</td><tdalign="center"style="width:40px;"><asp:LabelID="Lbl_Exist"Runat="server"Text='<%#DataBinder.Eval(Container.DataItem,"existArchive")%>'></asp:Label>&nbsp;</td><tdalign="center"style="width:60px;"><asp:LabelID="Lbl_Simple"Runat="server"Text='<%#DataBinder.Eval(Container.DataItem,"isSimple")%>'></asp:Label>&nbsp;</td><tdalign="center"style="width:40px;"><asp:LabelID="Lbl_Required"Runat="server"Text='<%#DataBinder.Eval(Container.DataItem,"required")%>'></asp:Label>&nbsp;</td><tdalign="center"style="width:40px;"><asp:LabelID="Lbl_Sequence"Runat="server"Text='<%#DataBinder.Eval(Container.DataItem,"sequence")%>'Visible="False"></asp:Label><asp:LinkButtonID="btnUp"Runat="server"CommandName="up">▲</asp:LinkButton><asp:LinkButtonID="btnDown"Runat="server"CommandName="down">▼</asp:LinkButton>&nbsp;</td><tdstyle="width:100px;">&nbsp;<asp:LabelID="Lbl_URI"Runat="server"Visible="false"Text='<%#DataBinder.Eval(Container.DataItem,"fieldURI")%>'></asp:Label><asp:LabelID="Lbl_Flag"Runat="server"Visible="false"Text='<%#DataBinder.Eval(Container.DataItem,"flag")%>'></asp:Label><asp:LinkButtonID="update"Runat="server"Visible="false"CommandName="update">修改</asp:LinkButton><asp:LinkButtonID="statusUpdate"CommandName="statusUpdate"Runat="server"><asp:LabelID="Lbl_Status"Runat="server"Text='<%#DataBinder.Eval(Container.DataItem,"status")%>'></asp:Label></asp:LinkButton><asp:LinkButtonID="delete"Runat="server"Visible="false"CommandName="delete">删除</asp:LinkButton>&nbsp;</td></tr></ItemTemplate></asp:repeater><asp:literalid="NonPanel"Runat="server"></asp:literal></TABLE></div></div>

解决方案十一:
建议找个“师傅”吧。
解决方案十二:
/*这里是滚动效果CSS*/#box{width:774px;height:20px;margin:19px0px0px6px;padding:0px;overflow:hidden;}#boxli{list-style:none;line-height:20px;color:#999;font-size:13px;}.newsContenta{display:block;color:#999;text-decoration:none;}.newsBox.newsContenta:hover{color:#23a3d7;}

//滚动支持的脚本<scriptlanguage="javascript"type="text/javascript">window.onload=function(){varo=document.getElementById('box');//容器、滚动对象window.setInterval(function(){scrollup(o,20,0);},3000);}/*滚动主方法=>参数:o滚动块对象,参数:d每次滚屏高度,参数:c当前已滚动高度*/functionscrollup(o,d,c){if(d==c){vart=getFirstChild(o.firstChild).cloneNode(true);o.removeChild(getFirstChild(o.firstChild));o.appendChild(t);t.style.marginTop="0px";}else{c+=2;getFirstChild(o.firstChild).style.marginTop=-c+"px";window.setTimeout(function(){scrollup(o,d,c)},20);}}functiongetFirstChild(node){while(node.nodeType!=1){node=node.nextSibling;}returnnode;}</script>

<divclass="newsBox"><h2>新闻动态</h2><divclass="newsContent"><ulid="box"><%--<li><ahref="#">滚动新闻1</a></li><li><ahref="#">滚动新闻1</a></li><li><ahref="#">滚动新闻1</a></li>--%><asp:RepeaterID="HotNews"runat="server"><ItemTemplate><li><%--<li><%=CreatCode.creatNews()%></li>--%><ahref="news_xi.aspx?view=<%#Eval("ID")%>"><%#web.Util.WbUI.CutString3(Eval("NewsTitles").ToString(),90)%>//我这里是截取多余字符调用方法(你可以去掉)<%#Eval("NewsTitles")#>//这是你需要的截取方法自己写</a></li></ItemTemplate></asp:Repeater></ul></div></div>

解决方案十三:
这个貌似只用aspx不行吧,还得要cs后台代码的引用9楼的回复:

HTMLcode<divid="contentDiv"><divid="titleDiv"><TABLEcellSpacing="0"cellPadding="0"border="1">……

解决方案十四:
看文档:
解决方案十五:
引用12楼的回复:

这个貌似只用aspx不行吧,还得要cs后台代码的引用9楼的回复:HTMLcode<divid="contentDiv"><divid="titleDiv"><TABLEcellSpacing="0"cellPadding="0"border="1">……

后台对repeater数据进行绑定就可以了
解决方案:
嗯,试了,第一个HTMLcode格式怪怪的,貌似没什么效果HTMLcode引用14楼的回复:

引用12楼的回复:这个貌似只用aspx不行吧,还得要cs后台代码的引用9楼的回复:<divid="contentDiv"><divid="titleDiv"><TABLEcellSpacing="0"cellPadding="0"border="1">后台对repeater数据进行绑定就可以了……

解决方案:
中间Eval()函数那里语法不对,我已经用Marquee实现了,thankyouanyway~引用11楼的回复:

CSScode/*这里是滚动效果CSS*/#box{width:774px;height:20px;margin:19px0px0px6px;patdding:0px;overflow:hidden;}#boxli{list-style:none;line-height:20px;color:#999;font-size:13px;}.new……

解决方案:
和gridview一样,只是repeater需要手写代码.
解决方案:
引用16楼的回复:

中间Eval()函数那里语法不对,我已经用Marquee实现了,thankyouanyway~引用11楼的回复:CSScode/*这里是滚动效果CSS*/#box{width:774px;height:20px;margin:19px0px0px6px;patdding:0px;overflow:hidden;}#boxli{list-style:……

那里不对?
解决方案:
引用18楼的回复:

引用16楼的回复:中间Eval()函数那里语法不对,我已经用Marquee实现了,thankyouanyway~引用11楼的回复:CSScode/*这里是滚动效果CSS*/#box{width:774px;height:20px;margin:19px0px0px6px;patdding:0px;overflow:hidden;}#boxl……

<ahref="news_xi.aspx?view=<%#Eval("ID")%>">这里的双引号吧,小问题

时间: 2024-08-02 16:17:08

repeater怎么使用的相关文章

Repeater中嵌套Repeater的示例

代码如下: protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { this.dtCategory = GetCategoryTable(); this.dtProduct = GetProductTable(); rptCategoryList.DataSource = dtCategory; rptCategoryList.DataBind(); } } // 准备一张分类表 DataTab

排序-asp.net repeater 绑定数据后 怎么改变显示的顺序

问题描述 asp.net repeater 绑定数据后 怎么改变显示的顺序 <ul style=" margin-left:20px"> <asp:Repeater ID="rep_data" runat="server"> <ItemTemplate> <li ><p ><span><%# Eval("data").ToString()%>:

Repeater中嵌套Repeater的示例介绍

 在某些特殊情况下是需要在Repeater中嵌套使用Repeater的,下面有个不错的示例,感兴趣的朋友可以参考下 代码如下: protected void Page_Load(object sender, EventArgs e)  {  if (!Page.IsPostBack)  {  this.dtCategory = GetCategoryTable();  this.dtProduct = GetProductTable();  rptCategoryList.DataSource

关于多层repeater,datagrid,datalist嵌套的示例

datagrid|示例 常常在CSDN上看到有网友问如何才能实现Repeater,DataList, DataGrid的嵌套问题,下面给出一个3层嵌套的示例,可以无限级嵌套下去 <ASP:REPEATER id="rpt_catalog" onitemdatabound="rpt_catalog_OnItemDataBound" runat="server"> <ITEMTEMPLATE>最顶层repeater,index

在Repeater中嵌套使用Repeater

在一般的网站中浏览类别的用户控件通常都位于大多数 ASP.NET 页的左边,它使用户能够按类别快速的查找产品.最近遇到一个客户,因为在他网站上展示的产品并不多,所以要求在原有类别浏览的基础上将产品也加进去.一来更方便,二来加长了左部导航栏的长度使页面更协调.原有的分类导航栏是由Repeater实现的,现在需要在每一个分类下加入该类的商品信息,于是我想到了在原有Repeater中嵌套Repeater.实现界面如下: 前台页面部分: <asp:Repeater id="rptCategorie

使用嵌套的Repeater控件显示分级数据

控件|数据|显示     简介       本文描述如何使用嵌套的Repeater 控件来显示分级数据 .当然了,你也可以将这一技术应用到其他的列表绑定控件上去,比如DataGrid包含DataGrid,DataList包含DataList等等的组合.       绑定到父表       1.添加一个新的Web Form 到应用程序项目中,名称为Nestedrepeater.ASPx.    2.从工具箱托动一个Repeater 控件到这个页面上, 设定其ID 属性为 parent .    3

使用嵌套的Repeater控件

控件 这个程序适用于:•Microsoft ASP.NET •Microsoft VS.NET 正式版 简介本文描述如何使用嵌套的Repeater 控件来显示分级数据 .当然了,你也可以将这一技术应用到其他的列表绑定控件上去,比如DataGrid包含DataGrid,DataList包含DataList等等的组合. 绑定到父表 1.添加一个新的Web Form 到应用程序项目中,名称为Nestedrepeater.aspx. 2.从工具箱托动一个Repeater 控件到这个页面上, 设定其ID

C#利用repeater 的嵌套实现一个自己想要的日历页面

repeater 控件是一个很灵活的东东,本人在程序开发中就最爱用到它了!!! 很多朋友应该在使用 VS2005 自带的 日历控件的时候 都发现或多或少的 不能满足自己的特殊需求 这个实例看似很简单 但如果能够家里改善 将能很好的运用到自己的程序当中(至少比用JS写个控件简单方便,还能很好的很数据库关联开发),本代码只粘贴出了日历的实现,实际上我用到了四个repeater 的嵌套 实现的是一个日程管理的系统, 剩下的和数据库有关联,所以删掉了! 希望对想使用日历控件的朋友有一定的帮助,注释写的很

ASP.NET 嵌套Repeater

asp.net 本来不怎么用Repeater的,可最近要显示留言板一样的东西,用Grid实现不好看,Grid比较适合正规的WEB系统,对于网站类型的,还是用Repeater了,遇到需要嵌套Repeater的情况,就收藏一下,以后可能还会用到哦.原文来自MS:http://support.microsoft.com/default.aspx?scid=kb;en-us;306154 iew products that this article applies to.Article ID : 306

向 Web 窗体页添加 Repeater 控件

web|控件   向页添加 Repeater Web 服务器控件需要若干步骤.下列过程描述创建一个工作的 Repeater 控件必须执行的最少步骤. 向 Web 窗体页添加 Repeater Web 服务器控件 向 Web 窗体页添加一个数据源.有多种方法可处理页上的数据.若要选择适当的方法,请参见 ADO.NET 数据访问介绍和对 Web 窗体页中数据访问的介绍. 在"设计"视图中,从"工具箱"的"Web 窗体"选项卡将 Repeater 控件