WebForm Repeater:重复器

  

五大模板:

HeaderTemplate - 头模板  里面内容在开始显示一遍

ItemTemplate - 项模板  有多少条数据显示多少条

FooterTemplate -脚模板  里面内容在结束显示一遍

AlternatingItemTemplate - 交替项模板 与ItemTemplate一起用

数据绑定

list<Users> li =new usersData().Select();

Repeater1.DataSource=li;
Repeater1.DataBind();

数据内容显示

页面数据显示位置:<%#Eval("属性名") %>

一、显示最终数据

字段扩展

二、标记颜色显示

封装字段

public string red

{

get{

   if(age>16)

   {return "

   }

   else{return "";}

}

}

style=“<%#Eval("red") %>”

问题三:
光棒效果,并且保留原有颜色

<script type="text/javascript">
var oItems = document.getElementsByClassName("tr_item");
for (var i = 0; i < oItems.length; i++)
{
var oldColor = "";
oItems[i].onmouseover = function ()

{
oldColor = this.style.backgroundColor;
this.style.backgroundColor = "yellow";
};

oItems[i].onmouseout = function ()

{
this.style.backgroundColor = oldColor;

};
}

原文地址:https://www.cnblogs.com/hongsen3/p/5968084.html