ASP.NET中的MsgBox [英] MsgBox in asp.net

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

问题描述

你好,

谁能告诉我为什么MsgBox()在asp.net中不能工作...对于我的某些网站它可以工作.但是在某些情况下,它显示错误.....
除了javascript之外,还有其他使用消息框的替代方法吗?
还是应该添加wat才能使MsgBox()工作?
我应该包括其他属性或名称空间吗?
预先谢谢您.

Hi there

Can anyone tell me why doesnt MsgBox() work in asp.net...For some my websites it works.but in some cases it shows error.....
Is there any alternate way to use message box other than javascript???
Or wat should additionally add to get MsgBox() work?
Should I include any other properties or namespaces?
Thank you in advance

推荐答案

U可以使用Ajax Extension的ModalPopupExtender....

ModalPopupExtender的脚本如下:

U can use ModalPopupExtender of Ajax Extension....

The script of the ModalPopupExtender is as follows:

<asp:ScriptManager id="ScriptManager1" runat="server">
    </asp:ScriptManager>
    <asp:Button ID="hiddenTargetControlForModalPopup" runat="server" Style="display: none" />
    <ajaxToolkit:ModalPopupExtender ID="programmaticModalPopup" runat="server" BackgroundCssClass="modalBackground"

        BehaviorID="programmaticModalPopupBehavior" DropShadow="True" PopupControlID="programmaticPopup"

        PopupDragHandleControlID="programmaticPopupDragHandle" RepositionMode="RepositionOnWindowScroll"

        TargetControlID="hiddenTargetControlForModalPopup">
    </ajaxToolkit:ModalPopupExtender>
    <asp:Panel ID="programmaticPopup" runat="server" CssClass="modalPopup" Style="display: none;
        width: 350px; padding: 10px">
        <asp:Panel ID="programmaticPopupDragHandle" runat="Server" Style="cursor: move; background-color: #DDDDDD;
            border: solid 1px Gray; color: Black; text-align: center;">
            Status
        </asp:Panel>
        <asp:UpdatePanel ID="UpdatePanel3" runat="server">
            <ContentTemplate>
<asp:Label id="lblStatusMessage" runat="server" Text="Label"></asp:Label>
</ContentTemplate>
        </asp:UpdatePanel>
        <asp:Button ID="OkButton" runat="server" OnClick="hideModalPopupViaServer_Click"

            Text="OK" Width="58px" />
        <br />
        </asp:Panel>



然后,在需要的地方使用ModalPopupExtender,可以使用下面的代码....



Then to use the ModalPopupExtender whereever u want u can use the code below....

{
    this.lblStatusMessage.Text="Message Here";
    this.programmaticModalPopup.Show();
}


注意->不要忘记在文件的后面的ur代码中添加以下代码,以使单击确定"按钮时,消息框"消失..


Note-> Dont forget to add the following code in ur code behind file to make the Messagebox disappear when the ok button is clicked..

protected void hideModalPopupViaServer_Click(object sender, EventArgs e)
{
    this.programmaticModalPopup.Hide();
}


请检查以下可能有帮助的教程:

http://www.4guysfromrolla.com/articles/021104-1.aspx [ ^ ]
Please check the following tutorial which might help:

http://www.4guysfromrolla.com/articles/021104-1.aspx[^]


什么样的您正在使用的消息框...


如果谈论Windows MessageBox.Show,那么它将仅适用于Windows应用程序...


在Web应用程序中使用MessageBox.Show()可以使用,但仅显示在服务器上.

这样做的原因是服务器正在处理您的代码.


要使其在客户端上起作用,您需要使用在客户端上处理过的代码,例如javascript.







What kind of message box your using...


If talking about Windows MessageBox.Show, then it will work for windows application only...


Using MessageBox.Show() in web apps will work, but it only displays on the server.

The reason for this is that the server is where your code is being processed.


To get this to work on the client side you need to use code that is processed on the client side, like javascript.








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

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