2

我正在使用 AJAX 工具包中的 ModalPopupExtender 控件。此控件扩展了包含 CreateUserWizard 控件的面板。但是,CreateUserWizard 控件的验证会导致回发到服务器,从而关闭弹出窗口。我希望弹出窗口保持打开状态,即使在回发之后也是如此。据我所知,我应该使用 UpdatePanel。但是,我似乎无法让它工作。它非常棘手的原因是结构应该是:

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 不会关闭?

谢谢你的帮助

4

2 回答 2

3

我设法在不使用更新面板的情况下解决了这个问题。相反,我处理了 CreateUserWizard 的“提交”按钮的 onClick 事件。在这里,我得到了存在于 CreateUserWizard 控件中的 ModalPopupExtender 实例并调用了它的Show()方法。我将 ModalPopup 声明留在<CustomNavigationTemplate>标签中,以便它Cancel仍然可以访问该按钮。

于 2010-02-03T20:49:22.153 回答
1

使用客户端验证或使用更新面板包装您的面板并调用模式扩展程序的 Show() 方法以从代码隐藏中显示模式。

于 2010-02-03T06:06:57.797 回答