webform上的消息(框) [英] Message(box) on webform

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

问题描述

如何在网页表格上收到消息(框),如msgbox(文本,类型

消息框,标题)

来自vs-help的代码。

Private Sub Button2_Click(ByVal sender As System.Object,ByVal e As

System.EventArgs)处理Button2.Click

Dim msg As String

Dim title As String

Dim style As MsgBoxStyle

Dim response As MsgBoxResult

msg ="你是想继续? ''定义消息。

style = MsgBoxStyle.DefaultButton2或_

MsgBoxStyle.Critical或MsgBoxStyle.YesNo

title =" MsgBox Demonstration" ''定义标题。

''显示消息。

response = MsgBox(msg,样式,标题)

如果response = MsgBoxResult.Yes然后''用户选择是。

''执行一些操作。

否则

''执行一些其他操作。

结束如果

结束子


我收到错误信息''显示模态daialogbox或
是不合法的
莫代尔形式...(翻译自挪威语)


问候


reidarT

How do I get a message(box) on a webform like msgbox(text,typeof
messagebox,Title)
Heres my code from the vs-help.
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button2.Click
Dim msg As String
Dim title As String
Dim style As MsgBoxStyle
Dim response As MsgBoxResult
msg = "Do you want to continue?" '' Define message.
style = MsgBoxStyle.DefaultButton2 Or _
MsgBoxStyle.Critical Or MsgBoxStyle.YesNo
title = "MsgBox Demonstration" '' Define title.
'' Display message.
response = MsgBox(msg, style, title)
If response = MsgBoxResult.Yes Then '' User chose Yes.
'' Perform some action.
Else
'' Perform some other action.
End If
End Sub

I get the error-message ''It is not legal to show a modal daialogbox or a
modal form ... (translated from norwegian)

regards

reidarT

推荐答案

" ReidarT" <再**** @ eivon.no> schrieb:
"ReidarT" <re****@eivon.no> schrieb:
如何在msgbox等webform上获取消息(框)(文本,typeof
消息框,标题)
How do I get a message(box) on a webform like msgbox(text,typeof
messagebox,Title)



要么使用客户端VBScript(''MsgBox'')或JScript(''alert'')。


-

MS Herfried K. Wagner

MVP< URL:http://dotnet.mvps.org/>

VB< URL:http://classicvb.org/petition/>


Either use a client-side VBScript (''MsgBox'') or JScript (''alert'').

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>


过去几个月我在几个论坛上看过这个问题。

一个论坛是 http://www.gotdotnet.com &微软开发人员说它不可能是b $ b。


在另外几个论坛上发现了相同的成员结论。


Herfried建议的方式是''popup''框而不是''消息框''。


Crouchie1998

BA(HONS)MCP MCSE
I have seen this question asked in a few forums over the past few months.
One forum is http://www.gotdotnet.com & a Microsoft Developer says that it
isn''t possible.

On another few forums the same conclusion of the members was found.

The way Herfried is suggesting is a ''popup'' box not a ''message box''.

Crouchie1998
BA (HONS) MCP MCSE


>我收到错误消息''显示模态daialogbox或
> I get the error-message ''It is not legal to show a modal daialogbox or a
模态形式是不合法的......(翻译自挪威语)
modal form ... (translated from norwegian)




哦,恐怕不是一个简单的答案。这是非常困难的,因为你经常想要

来显示一个消息框以响应按钮点击。此按钮单击是

,最有可能由服务器端单击事件处理。但是你的检查代码

现在在服务器上运行,而不是在客户端上运行。因此,您必须使用某种标记/消息设置回发页面

,以便客户端代码

然后可以弹出一个通常隐藏的DHTML用户控件。


我们这样做的方式:


o用文本框和命令创建一个简单框架的用户控件

里面的按钮

o这个放在页面上的DIV里面,通常隐藏在

Style.Visibility =" False"

o当需要弹出消息时,将消息存储在会话中

缓存(实际上)并让帖子返回到同一表格

o在Page_Load中,它检查会话缓存中的消息,将DIV设置为

可见,位置在中间

o然后从会话缓存中清除该消息,以便它不会在下一篇文章中显示



我们使用一些JavaScript隐藏/显示框。我不记得为什么

我们做这个客户端,因为我确定我们可以做服务器端。


还有很多其他的方式也是如此。以上所有内容都来自记忆:-)


简单的MsgBox要求是最单一的最简单项目之一

没有突出显示标准

客户端应用程序与网络应用程序的架构差异......


干杯,Rob。



Ohh, not an easy answer I''m afraid. It''s surprisingly hard as you often want
to show a message box in response to a button click. This button click is
most probably handled by the server side click event. But your "check" code
is now running on the server, not on the client. So you have to post back
the page with some kind of flag/message set-up so that the client side code
can then popup a normally hidden DHTML user control.

The way we do it something along these lines:

o Create a user control that''s a simple frame with a textbox and the command
buttons inside
o This is placed inside a DIV on the page and normally hidden via
Style.Visibility="False"
o When the popup message is required, a store the message in the session
cache (in effect) and let the post back carry on to the same form
o In Page_Load, it checks the session cache for the message, sets the DIV to
visible and positions in the middle
o The message is then cleared from the session cache so that it doesn''t
appear next post back

We use a bit of JavaScript to hide/show the box. I can''t remember quite why
we do this client side as I''m sure we could do it server side.

There are many other ways as well. All of above is from memory :-)

The simple "MsgBox" requirement is one of the most single simplest items
that doesn''t have highlight the difference in architecture of standard
client apps to web apps...

Cheers, Rob.


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

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