asp.net模态弹出和回发 [英] asp.net Modal Popup and Postbacks

查看:106
本文介绍了asp.net模态弹出和回发的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述





我有一个模态弹出扩展器,就像一个消息框一样。



流程如下:



1.我在登录文本框中输入用户名和密码

2.我按下登录按钮。 />
3.当密码即将过期时,此模式弹出窗口显示您的密码即将过期。您要立即更改吗?

4.步骤3原因回复和步骤1中的密码被删除。

5.我回答步骤3,单击是,步骤1的密码验证器突出显示,因为密码不能为空。



我想避免这种情况。我只是希望Modal弹出窗口加载离开父页面!



我按照创建虚拟按钮以附加到扩展器的简单指南。引用的面板也位于更新面板中。密码到期时调用modal.show()(有条件的)。



还有什么必须在场吗?如果我将扩展程序附加到登录按钮,它会按预期显示但立即显示,后面的代码不会执行。我只想要一种无需使用可见性的方式。



万分感谢您的宝贵帮助。

Justin

解决方案





在你的问题中,我看到两个部分,



1.密码的验证器在模态弹出窗口发生回发时显示错误消息。

Ans。将验证组提供给登录按钮。

指定验证组 [ ^ ]



2.您已将模态弹出窗口的Target Control提供给登录按钮,因此,即使有效密码,弹出窗口也会打开。



答案。从登录按钮中删除模态弹出窗口的目标控件。让登录按钮触发服务器端事件,如果你发现密码即将到期,则显示服务器端的模态弹出窗口,隐藏目标控件ID。



check下面链接显示来自服务器端的模态弹出窗口,隐藏目标控件ID: -

模态弹出窗口扩展服务器端显示() [ ^ ]

ASP.NET AJAX控件工具包:显示ModalPopup,然后执行PostBack [ ^ ]



希望它有帮助

Hi,

I have a modal popup extender that just works like a message box.

The process is as follows:

1. I input username and password in login textboxes
2. I press Login button.
3. When the password is about to expire, this modal popup appears stating "Your password will expire soon. Do you want to change it now?"
4. Step 3 causes postback and the password in Step 1 gets deleted.
5. I answer Step 3 by clicking on Yes and the password validator for Step 1 highlights since the password cannot be left empty.

I would like to avoid this scenario. I just want the Modal popup to load leaving the parent page as is!

I followed the simple guide of creating the dummybutton to attach to the extender. The referenced panel is also in an update panel. modal.show() is being called when password is due (conditional).

What else has to be present please? If I attach the extender to the login button it shows up as intended but immediately and the code behind doesn''t execute. I just want a way that works without having to play with the visibility.

Thanks a million for your valuable help.
Justin

解决方案

Hi,

In your question i see two parts,

1. the validator for password shows error message whenever postback happens from modal popup.
Ans. Give Validation group to the login button.
Specifying Validation Groups[^]

2. You have given Target Control of modal popup to login button, because of this, the popup is opening even if the valid password.

Ans. remove target control of modal popup from login button. let the login button fire the server side event, and if you find that, password is expiring then show the modal popup from server side with hidden target control ID.

check below links to show modal popup from server side with hidden target control id:-
Modal Popup Extender server side Show()[^]
ASP.NET AJAX Control Toolkit: Show a ModalPopup and then do PostBack[^]

hope it helps


这篇关于asp.net模态弹出和回发的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆