使用asp.net的WebApplication中的MessegeBox [英] MessegeBox in WebApplication using asp.net

查看:84
本文介绍了使用asp.net的WebApplication中的MessegeBox的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我可以在Web应用程序中使用什么,就像我们在Windows应用程序中使用MessegeBox.show()一样.其他警报,确定并取消....:omg:

What i can use in webapplication lik we use MessegeBox.show()in windows application. othr thn alert,ok and cancel.... :omg:

推荐答案

MessageBox方法是一种客户端方法,但是Web应用程序在服务器上运行.这就是为什么它在本地运行时似乎可以工作的原因(因为服务器"实际上是本地计算机),但是在服务器上运行时却不起作用.

如果要向他们传递消息,请尝试使用警报",或者如果要他们回答确定"或取消",请尝试确认.为此,可以在页面加载事件中向按钮添加onclick事件.
MessageBox method is a client side method, but a web application runs on the server. This is why it seems to work when you are locally running it (as your "server" is actually your local machine), but doesn''t work when you run it on your server.

Try using Alert if you want to pass them a message, or Confirm if you want them to answer OK or Cancel. Do this by adding an onclick event to your button in the page load event.


有3种类型的javascript对话框可用:

1.警报:其中只有确定"按钮.
2.确认:具有确定"和取消"
3.提示:其中有一个文本框,然后单击确定/Cancel

除此之外,如果您需要任何其他消息,则需要使用HTML来完成.将绝对位置div放置在文档上,并以准确的设计作为警告.

:)
There are 3 types of javascript Dialog available:

1. alert : which have only OK button in it.
2. confirm : which has Ok and Cancel
3. prompt : which has a textbox and OK /Cancel

Other than that, if you want any other message, you need to do it using HTML. Place a absolute position div over the document with exact design as alert.

:)


我建​​议您在ASP.NET上购买一本非常基础的书,然后再继续阅读.您显然没有完成任何课程,因此我假设您正在自学,而不是编写任何人都会使用的代码.

任何winforms方法将仅显示在服务器上.根据定义,任何C#代码都可以在服务器上运行.这些是Web开发的基础.您的浏览器知道如何显示HTML和运行javascript.使用RegisterClientScriptBlock将javascript注入页面是如何在回发之后使弹出窗口在客户端发生.
I would suggest you buy a VERY basic book on ASP.NET and read it before you go any further. You''ve plainly not done a course, so I assume that you''re teaching yourself, and not writing code anyone will ever use.

Any winforms methods will show on the server only. Any C# code, by definition, runs on the server. These are basics of web development. Your browser knows how to display HTML and run javascript. Injecting javascript into the page with RegisterClientScriptBlock is how to get a popup to occur on the client side, after a postback.


这篇关于使用asp.net的WebApplication中的MessegeBox的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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