ItemDataBound 事件中获取行的值

protected void RepService_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"));
                RepeaterItem item = e.Item;
                string summary = DataBinder.Eval(e.Item.DataItem, "summary").ToString();
                LinkButton LinkBtnExam = e.Item.FindControl("LinkBtnExam") as LinkButton;
                if (string.IsNullOrEmpty(summary))
                {
                    LinkBtnExam.Enabled = false;
                }
            }
        }
posted @ 2011-05-27 15:04  左正  阅读(431)  评论(0编辑  收藏  举报