我正在使用AJAX工具包中的ModalPopupExtender控件。该控件扩展了一个包含CreateUserWizard控件的面板。但是,CreateUserWizard控件的验证会导致回发到服务器,从而关闭弹出窗口。我希望弹出窗口保持打开状态,即使在回发之后。从我可以收集的信息来看,我应该使用UpdatePanel。但是,我似乎无法得到它的工作。它是相当棘手的原因是因为结构应该是:防止在回发时关闭ModalPopup
ModalPopupExtender
<Panel>
<UpdatePanel>
<ContentTemplate>...</ContentTemplate>
</UpdatePanel>
</Panel>
我不能按照这个结构,因为ModalPopupExtender
依靠其包含在CreateUserWizard控件中的按钮。因此,它必须在<asp:CreateUserWizard> </asp:CreateUserWizard>
标记中添加。我想要在CreateUserWizard控件中内置的提交按钮来强制更新面板。关于结构应该如何的任何建议?我的代码是高度定制的,所以它很长。但是,关键结构与此类似:
<asp:Panel>
<asp:CreateUserWizard>
<WizardSteps>
<asp:CreateUserWizardStep>
<ContentTemplate>
//Form Controls here
</ContentTemplate>
<CustomNavigationTemplate>
//The SUBMIT button that should force update
//CANCEL button
<asp:ModalPopupExtender /> //References the CANCEL button therefore has to be here
</CustomNavigationTemplate>
</asp:CreateUserWizardStep>
</WizardSteps>
</asp:CreateUserWizard>
</asp:Panel>
UpdatePanel的位置会被放置吗?还是有更有效的方式确保ModalPopup不会关闭?
感谢所有帮助
我试着将UpdatePanel放在整个面板上,但我只是得到'扩展器不能在不同的UpdatePanel中,而不是它扩展的控件.'错误。 – keyboardP
你不应该把你的扩展器放在不同的UpdatePanel中。如果您使用的是嵌套的UpdatePanel,则需要将扩展器从内部UpdatePanel中移出,或者删除内部的UpdatePanel。 –