2.单击按钮时,动态按钮不会触发 [英] 2.dynamically button not firing while the button click
问题描述
按钮在面板上单击时动态按钮不会触发。
我尝试过:
btn_Reply.ID =btn_ReplyUser+ i;
btn_Reply.Text =回复;
btn_Reply.Width = 250;
bnn_Reply.AutoPostBack = true;
btn_Reply.Command + = new CommandEventHandler(btn_Reply_command);
btn_Reply.Click + = new System.EventHandler(btn_ReplyUser );
btn_Reply.CausesValidation = false;
this.form1.Controls.Add(btn_Reply)
pnlpopup.Controls.Add(btn_Reply)
private void btn_ReplyUser(object sender,EventArgs e)
{
//抛出新的NotImplementedException() ;
TextBox txt_re = new TextBox();
txt_re.Text =Hello;
}
Dynamically button not firing while the button click from panel.
What I have tried:
btn_Reply.ID = "btn_ReplyUser" + i;
btn_Reply.Text = "Reply";
btn_Reply.Width = 250;
btn_Reply.AutoPostBack = true;
btn_Reply.Command += new CommandEventHandler(btn_Reply_command);
btn_Reply.Click += new System.EventHandler(btn_ReplyUser);
btn_Reply.CausesValidation=false;
this.form1.Controls.Add(btn_Reply)
pnlpopup.Controls.Add(btn_Reply)
private void btn_ReplyUser(object sender, EventArgs e)
{
//throw new NotImplementedException();
TextBox txt_re = new TextBox();
txt_re.Text = "Hello";
}
推荐答案
你好朋友你按钮Id名称和你的方法名称应该相同。我在你的动态按钮ID中同时改变,这样就不会触发你的按钮。生成按钮名称时应更改方法名称。
Hi friend You button Id name and your method Name should be same. I thing in your dynamic button id simultaneously changing so that not fire your button. while generating button name should be change method name.
这篇关于2.单击按钮时,动态按钮不会触发的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!