消息框问题! [英] Problem with messagebox!

查看:55
本文介绍了消息框问题!的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

im c#starter

i在我的项目中放了一个消息框,但它总是最小化,用户应该点击它上来!

我该怎么办? br $> b $ b

我尝试过:



MessageBox.Show(نامکاربری یارمزعبوراشتباه!);

im c# starter
i put one messagebox in my project but it is always minimize and the user should click on it to come up!
what should i do?

What I have tried:

MessageBox.Show("نام کاربری یا رمز عبور اشتباه!");

推荐答案

不要在ASP.NET上使用MessageBox.Show。使用这个:

Don't use MessageBox.Show on ASP.NET. Use this one:
Page.ClientScript.RegisterStartupScript(this.GetType(), "scriptkey", "<script>alert('your message');</script>");


你不能在ASP.NET中使用 MessageBox ,因为你没有想尝试在服务器端显示模式框。 :-)



使用JavaScript alert 通常也不好;它不仅非常不灵活,而且你无法设计风格或使其外观和行为独立于操作系统和特定的浏览器;对于生产质量应用程序,这还不够好。



有关类似对话框行为的解决方案选择的进一步说明,请参阅我的文章从零开始的模态弹出窗口



它会好得多在网页中开发类似模态的行为,并使用JavaScript在本地完成。第一个解决方案是: https://jqueryui.com/dialog [ ^ ]。



此外,还有很多第三方jQuery插件,统称为模态弹出窗口,具有不同的效果,例如过渡,特别是页面其余部分的变暗。请参阅: http://bfy.tw/AJH [ ^ ]。



如果您需要学习jQuery,请参阅:

http://en.wikipedia.org/wiki/JQuery

http://jquery.com

http ://learn.jquery.com

http:// learn。 jquery.com/using-jquery-core

http ://learn.jquery.com/about-jquery/how-jquery-works (从这里开始)。



替代方案是实施从头开始的模态弹出窗口,我在上面引用的文章中详细解释过。



-SA
You cannot use MessageBox in ASP.NET, because you don't want to try to show a modal box on the server side. :-)

Using JavaScript alert is also usually not good; not only it is badly inflexible, but you cannot style it or make its look and behavior independent of the OS and particular browser; for production quality applications, this is not good enough.

For further explanation of the choice of the solution for the dialog-like behavior, please see my article Modal Popup From Scratch.

It would be much better to develop modal-like behavior inside a Web page, and do it fully locally, with JavaScript. The first solution would be this: https://jqueryui.com/dialog[^].

Also, there are many 3rd-party jQuery plug-ins, collectively known as "modal popup", with different effects, such as transitions, and, notably, dimming of the rest of the page. Please see: http://bfy.tw/AJH[^].

If you need to learn jQuery, please see:
http://en.wikipedia.org/wiki/JQuery,
http://jquery.com,
http://learn.jquery.com,
http://learn.jquery.com/using-jquery-core,
http://learn.jquery.com/about-jquery/how-jquery-works (start from here).

The alternative would be the implementation of modal popup from scratch, which I explained in detail in my article referenced above.

—SA


这篇关于消息框问题!的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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