Repeater绑定事件ItemDataBound中获取数据库中数据

protected void rp1_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {

             if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)

             {
                        //DataBinder.Eval(e.Item.DataItem, "数据库字段")
                      //int i = Convert.ToInt32(Databinder.Eval(e.Item.DataItem,"ID"));
                          Response.Write(Convert.ToInt32(DataBinder.Eval(e.Item.DataItem, "ID")+"<br>"));

               }
        }

posted @ 2013-12-18 16:39  甜菜波波  阅读(853)  评论(0编辑  收藏  举报