1.控制Repeater表格中的按钮显隐
1.1 定义方法
public void Repeater1_ItemDataBinding(object sender, RepeaterItemEventArgs args) { if (((DataRowView)args.Item.DataItem)["bank"].ToString() == "支付宝") args.Item.FindControl("LinkButton1").Visible = false; }
1.2 绑定事件方法(后台绑定)
Repeater1.ItemDataBound += new RepeaterItemEventHandler(Repeater1_ItemDataBinding);//控件中某一项数据绑定后但未呈现在页面之前触发时间
2.控制Repeater表格中按钮事件
2.1 定义事件
protected void Repeater1_ItemCommand(object source, RepeaterCommandEventArgs e) { if (e.CommandName == "FindDetail") { string id = e.CommandArgument.ToString();//页面传过来的参数 } }
2.2 绑定事件方法(前台绑定)
OnItemCommand="Repeater1_ItemCommand"