• 博客园logo
  • 会员
  • 众包
  • 新闻
  • 博问
  • 闪存
  • 赞助商
  • HarmonyOS
  • Chat2DB
    • 搜索
      所有博客
    • 搜索
      当前博客
  • 写随笔 我的博客 短消息 简洁模式
    用户头像
    我的博客 我的园子 账号设置 会员中心 简洁模式 ... 退出登录
    注册 登录
make a different
博客园    首页    新随笔    联系   管理    订阅  订阅
Repeater

1。对满足条件的行中的操作设置:

如将 LinkButton设置为不可用

  protected void RPTProject_ItemDataBound(object sender, RepeaterItemEventArgs e)
    {
        if (e.Item.DataItem!= null)
        {
            string PAllow = ((DataRowView)(e.Item.DataItem)).Row["列绑定值"].ToString();
            string BAllow = ((DataRowView)(e.Item.DataItem)).Row["列绑定值"].ToString();
            if (PAllow == "True"&&BAllow=="True")
            {
                ((LinkButton)e.Item.Controls[e.Item.Controls.Count - 2].FindControl("LBTCloseCountP")).Visible = false;
            }
        }
    }

2。

获取Repeater中Footertemplate内控件和值的方法

Footertemplate是Repeater内最后一个Controls。
Repeater1.Controls[Repeater1.Controls.Count - 1]代表的就是Footertemplate内控件的集合。要获取其中的控件在此基础上直接FindControl("控件的ID")就行了。这样获取的Control的类型需要自己指定。

    例:

int p = Convert.ToInt32(((DropDownList)Repeater1.Controls[Repeater1.Controls.Count - 1].FindControl("ddlp")).SelectedValue) - 1;

    PS:必须在Repeater建立后使用此方法。

    PS:获取Repeater中HeaderTemplate及其他集合内控件和值的方法以此类推

posted on 2010-07-30 14:21  雨荨  阅读(771)  评论(0)    收藏  举报
刷新页面返回顶部
博客园  ©  2004-2025
浙公网安备 33010602011771号 浙ICP备2021040463号-3