问题描述
你好,
谁能告诉我为什么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
推荐答案
<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();
}
这篇关于ASP.NET中的MsgBox的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!