ModalPopUpExtender 按钮事件处理程序未触发

发布于 2024-11-29 05:58:19 字数 997 浏览 1 评论 0 原文

我有一个事件处理程序附加到模态弹出窗口中的按钮。我试图在事件处理程序中传递参数,但没有取得任何成功。我已分别尝试了两行代码,但单击按钮时没有任何反应。还有其他方法可以将多个数据从 modalpopup 传递到方法吗?我还尝试了一个 EventHandler ,它调用了一个简单的方法,不传递任何额外的参数,但仍然一无所获。

谢谢

save.Click += (object sndr, EventArgs ee) => saveIssueModal(sndr, ee, cguid, ddlStatus.SelectedValue.ToString());

还是

save.Click += delegate(object sender2, EventArgs ee) { saveIssueModal(sender2, ee, cguid, ddlStatus.SelectedValue.ToString()); };

…………

Button save = new Button();
save.Text = "Save";
save.Click += new EventHandler(saveIssueModal);

issuePnl.Controls.Add(save);    

IssuesPanel.Controls.Add(issuePnl);

issueMPE = new AjaxControlToolkit.ModalPopupExtender();
issueMPE.ID = "issueMPE1";
issueMPE.TargetControlID = newBtn.ID;
issueMPE.PopupControlID = issuePnl.ID;
IssuesPanel.Controls.Add(issueMPE);

I have an eventhandler attached to a button in a modalpopup window. I am trying to pass parameters in the eventhandler but have not had any success. I have tried both lines of code separately and nothing happens when the button is clicked. Is there any other way to pass multiple data from a modalpopup to a method? I've also tried an EventHandler that called a simple method that does not pass any extra parameters and still got nothing.

Thanks

save.Click += (object sndr, EventArgs ee) => saveIssueModal(sndr, ee, cguid, ddlStatus.SelectedValue.ToString());

or

save.Click += delegate(object sender2, EventArgs ee) { saveIssueModal(sender2, ee, cguid, ddlStatus.SelectedValue.ToString()); };

...

Button save = new Button();
save.Text = "Save";
save.Click += new EventHandler(saveIssueModal);

...

issuePnl.Controls.Add(save);    

...

IssuesPanel.Controls.Add(issuePnl);

...

issueMPE = new AjaxControlToolkit.ModalPopupExtender();
issueMPE.ID = "issueMPE1";
issueMPE.TargetControlID = newBtn.ID;
issueMPE.PopupControlID = issuePnl.ID;
IssuesPanel.Controls.Add(issueMPE);

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

树深时见影 2024-12-06 05:58:19

试试这个:

save.Click += (sender, args) => saveIssueModal(<Custom Arguments>, args);

编辑:
尝试分配一个基本的事件处理程序:

save.Click += new EventHandler(saveIssueModal);

Try this:

save.Click += (sender, args) => saveIssueModal(<Custom Arguments>, args);

EDIT:
Try this for assigning a basic event handler:

save.Click += new EventHandler(saveIssueModal);
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文