带用户控件的模态弹出窗口 [英] modal popup with user control
问题描述
大家好,
我在asp.net中创建了一个自定义LogIn UserControl(ascx)
并将其放到aspx内容中Page(这是继承自Master Page)。
我想做什么:
我的UserControl上有一个ASP按钮和一个aspx页面上的链接按钮。当我单击链接按钮时,UserControl将使用Ajax Modal Pop-Up显示为POP-UP。现在的问题是,对于每个未成功的LogIn(通过检查数据库中的UserId和密码),弹出窗口消失并显示aspx页面。但它不应该。
如果每个未成功的LogIn在同一个弹出窗口中显示错误消息?
请分享代码(如果可能的话)。
提前致谢.....
Hi All,
I have created a custom LogIn UserControl(ascx) in asp.net
and placed it to aspx Content Page (this is inherited from Master Page).
What I want to do :
There is a ASP Button on my UserControl and a Link Button on aspx page. When I click on Link Button, UserControl is showing as a POP-UP using Ajax Modal Pop-Up. Now problem is that for every un-successful LogIn (by checking UserId & Password in Database), Pop-Up is disappeared & the aspx page is showing. But it should not be.
How can I display an error message in the same pop-up window for every un-successful LogIn ?
Please share the code (if possible).
Thanks in advance .....
推荐答案
是的,每次回发modalpopup都会消失。您需要从后端显示它。在您的情况下,如果登录不成功,您应该显示弹出窗口。试试这个:
Yes, for every postback modalpopup will disappear. You need to show it from back-end. In your case you should show the popup if login is not successful. Try this:
if(loginSuccessfull)
{
//Write your code here to go to home page.
}
else
{
//Show the modal popup extender
ModalPopupExtender1.Show();
}
--Amit
--Amit
这篇关于带用户控件的模态弹出窗口的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!