本人菜鸟:Repeter 控件添加事件
我已经写好了Repeter控件的响应函数,public void Repeater1_ItemCommand(object source, System.Web.UI.WebControls.RepeaterCommandEventArgs e){
Label1.Text="wuao";
}
<asp:repeater id="Repeater1" runat="server" OnItemCommand="Repeater1_ItemCommand">
也添加了<asp:Button CommandName="CTest" ID="CTest" BorderColor="#333366" Runat="server" Text="OK"></asp:Button>
怎么运行后按钮没有反应啊 --------------------编程问答-------------------- 加
this.Repeater1.ItemCommand += new System.Web.UI.WebControls.RepeaterCommandEventHandler(this.Repeater1_ItemCommand); --------------------编程问答-------------------- <asp:Button CommandName="CTest" ID="CTest" BorderColor="#333366" Runat="server" Text="OK" UseSubmitBehavior="false"></asp:Button>
--------------------编程问答-------------------- 顶 --------------------编程问答--------------------
--------------------编程问答--------------------
//这样:
<asp:Button ID= "CTest " BorderColor= "#333366" Runat= "server" onclick="Ok"> </asp:Button>
//后台:
public void Ok(object sender,EventArgs args)
{
//在这里写方法
}
--------------------编程问答-------------------- http://blog.csdn.net/xianfajushi/archive/2008/11/30/3413317.aspx --------------------编程问答-------------------- 两大强人出现了,,,什么也别说..不出声了
//如果在后台方法里面获取当前点击的行,然后进行操作也很简单。如:
public void Ok(object sender, EventArgs e)
{
RepeaterItem ditm = (RepeaterItem)((Button)sender).Parent;//这个就获取到当前行了
}
补充:.NET技术 , ASP.NET