Pergunta

I need to use ModalPopupExtender for the main form to display a subform. I need to trick the ModalPopupExtender without linking to button event hence used a hidden field as TargetControlID and PopupControlId

I have a submit button in the main form, when i click on it it first displays the Panel (subform) using the ModalPopupExtender (which also has cancel button in it).
I call the modalscreen by using Show() function. The problem happens as soon as i click on Cancel button in the Modal Form to Hide the form, the rest of the values filled in the main form get erased. Also other thing which I noticed if I use the ModalPopupExtender without Show & Hide function and link it to some temporary button click event, it works as expected and the values in the main form don't get erased. Can anyone help how to resolve this issue?

Foi útil?

Solução

I think cancel button is causing postback.If you are using asp:button then change it to normal html button below

<asp:Panel runat="server" ID="popup" CssClass="panelStyle">
    <input type="button" id="btnCancel" onclick="Cancel()" value="Cancel" />
</asp:Panel>


<script type="text/javascript">
    function Cancel() {
        $find("modalBehavior").hide();
    }
</script>
Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top