看 .aspx 代码:
1
<%# Eval("UserName") %> | 12<%# Eval("Title") %> |
15 ||||
18 | <%# Eval("cont") %> | 19||||
| 22 23
我们就是依靠 这两个 Onitemcommand 事件来执行代码的。 来看一下, .cs 代码 1 protected void Repeater1_ItemCommand(object source, RepeaterCommandEventArgs e) 2 //在这里处理第1个Button事件,因为这个Button位于第一个 Repeater中。 3 //在这里是不能捕捉到第二个Repeater控件中的Button事件的。 4 { 5 if (e.CommandName == "deletely") 6 { 7 int dlid = Convert.ToInt32(e.CommandArgument.ToString()); 8 opclass opc = new opclass(); 9 opc.ExectCmd(string.Format("Delete From [liuyan] Where ID={0}", dlid)); 10 opclass opc1 = new opclass(); 11 opc1.ExectCmd(string.Format("Delete From [Reply] Where lyID={0}", dlid)); 12 bangdingdata(); 13 14 } 15 } 16 17 protected void Repeater2_ItemCommand(object source, RepeaterCommandEventArgs e) 18 //在这里处理第2个Button事件,因为这个Button位于第二个 Repeater中。 19 { 20 if (e.CommandName == "deletehf") 21 { 22 int dlid = Convert.ToInt32(e.CommandArgument.ToString()); 23 opclass opc = new opclass(); 24 opc.ExectCmd(string.Format("Delete From [Reply] Where ID={0}", dlid)); 25 bangdingdata(); 26 27 28 } 29 30 } 提示: 点击外层的 Repeater 控件的时候,在属性对话框中,可以找到 _disibledevent=> 延伸阅读发表评论 |
最新评论