Pergunta

I have a bit of an odd issue. I am using a modal popup and it requires a button but I call it via code.

<ajaxToolkit:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server"></ajaxToolkit:ToolkitScriptManager>

<ajaxToolkit:ModalPopupExtender ID="MPE" runat="server"
    TargetControlID="phantomButton"
    PopupControlID="infoPanel"
    CancelControlID="closeInfoPanelButton"
    DropShadow="true">
</ajaxToolkit:ModalPopupExtender>
<asp:Button ID="phantomButton" runat="server" Text="phantomButton" CssClass="phantomButton" />

PhantomButton is hidden via CSS. I have another text box and when enter is pressed it appears to fire the phantom button which causes the popup. Why would this be happening? Also, how do I disable the button so this doesn't happen?

Foi útil?

Solução

Check the Default Button property of your modal popup panel (or whatever panel your textbox is in). Most likely this property was set to PhantomButton my mistake. If this is the case, whenever that textbox receives focus and enter is pressed, it will trigger your PhantomButton click event. See here for more info on the default button.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top