Repeater控件

ItemDataBound事件
  protected void Repeater1_ItemDataBound(object sender, RepeaterItemEventArgs e)
    {
        //判断数据行的类型
        if (e.Item.ItemType == ListItemType.AlternatingItem || e.Item.ItemType == ListItemType.Item)
        {      
           //执行相应函数
        }
    }


寻找某个控件并进行转换
Label lable1= e.Item.FindControl("lable1") as Label;
Button Button1 = e.Item.FindControl("Button1") as Button;


ItemCommand事件
protected void rptDel_ItemCommand(object source, RepeaterCommandEventArgs e)
    {
       //判断某个控件的CommandName
       if (e.CommandName == "Button1")
        {
        }
    }


绑定数据格式
<%# Eval("Time", "{0:yyyy-MM-dd}") %>

你可能感兴趣的:(C++,c,C#)