使用 MVP 从 ASP.NET Web 表单中的事件背后的代码调用 jquery 模态
我有一个带有登录按钮的 aspx 页面。我想在密码不匹配的情况下显示 jquery 模式窗口。基本上,当用户单击 asp:button 时,我会从代码隐藏中调用 Presenter 的方法 (MVP),然后返回 true 或 false。如果它是假的,我想调用这个jquery模态窗口...我一直在尝试使用一些jquery插件,但它不起作用。我对 jquery 相当陌生。也许这很容易,但对我来说似乎很疯狂。我看过很多示例,但它们都等待单击操作打开。基本上我必须等待代码的响应才能触发此操作。
void btnSubmit_click(sender, e)
{
if presenter.Login(x,y)
Response.Redirect(the page);
else
jquery modal window
}
有谁知道如何实现这一目标? 谢谢
i have a aspx page with a Login button. I want to, in case password does not match, to show a jquery modal window. Basically when the user click on an asp:button i call the Presenter's method (MVP) from my code-behind and i return either true or false. If it's false, i want to call this jquery modal window... i've been trying with some jquery plugins but it's not working. i am fairly new to jquery. maybe it's easy but it seems crazy to me. I've seen a lot of samples but all of them wait for the click action to open up. Basically i have to wait for a response from my code in order to trigger this.
void btnSubmit_click(sender, e)
{
if presenter.Login(x,y)
Response.Redirect(the page);
else
jquery modal window
}
Does anyone have an idea on how to achieve this?
Thank you
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
如果我理解正确的话,这里有一个快速而肮脏的方法,应该可以帮助您指明正确的方向。尝试在页面上添加一个空标签(禁用视图状态),您可以在其中呈现 HTML。使用此标签呈现 JavaScript,以便在需要时打开 JQuery 模式弹出窗口。
这可能看起来像:
无论如何......这是一个非常粗略的例子,但它应该给你一个开始。
If I am understanding correctly, here is a quick and dirty that should get you pointed in the right direction. Try adding an empty label on the page (with the viewstate disabled) where you can render HTML. Use this label to render the JavaScript to open your JQuery modal pop-up when you need to.
This may look something like:
Anyway... that's a pretty rough example but it should give you a start.
你是什么意思:“jquery 模式窗口”?您在服务器中显示代码。您可以生成一个响应,其中包含一个 jquery 对话框作为其 onload 操作。
What do you mean: 'jquery modal window'? You show code in the server. You may generated a response that contains as its onload action a jquery dialog box.