user1889838
user1889838

Reputation: 343

Cannot run event handler in .cs file from ModalPopupExtender

I want to create a simple Yes/No popup window. So I have added a ModalPopupExtender to the .aspx page.

The popup panel's markup is:

<asp:Button ID="btn_yes" runat="server" Text="Yes" onclick="btn_yes_Click" />
  <br/>
  <br/>
<asp:Button ID="btn_no" runat="server" Text="No" />

For some reason, I cannot get into the function btn_yes_Click, not sure why. Do I have to use Javascript?

Upvotes: 1

Views: 385

Answers (2)

Asimov
Asimov

Reputation: 65

There is a chance that the OKControlID Property on ModalPopupExtender tag is specified. Take a look at this topic: The Event Handler of the OK button inside a Modal PopUp is not executing

Upvotes: 0

matei.navidad
matei.navidad

Reputation: 745

I suspect that you are also setting the ModalPopupExtenders OkControlID property to "btn_yes". As you can see in this related question this will cause the OnClick event not to fire.

Upvotes: 2

Related Questions