在asp.net中创建一个消息框(c#) [英] Create a messagebox in asp.net (c#)

查看:64
本文介绍了在asp.net中创建一个消息框(c#)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

很长一段时间Winforms程序员试图成长网....在我的第一个真正的asp.net网站项目大约30分钟后,我需要一个MessageBox函数.....我发现的一切都涉及跳过火和javascript函数的箍从用户那里获得简单的价值。真的吗?是否有一个简单的服务器端控件模仿Winforms控件的功能,您只需调用它并返回用户选择的值?

Long time Winforms programmer trying to grow webs....after about 30 minutes into my first real asp.net website project I need a MessageBox function..... Everything I find involves jumping through hoops of fire and javascript functions to get back as simple value from the user. Seriously? Is there not a simple server-side control that mimics the function of a Winforms control where you just call it and it returns the value the user selected?

推荐答案

Web应用程序完全是关于HTML和JavaScript。这里没有消息框等效的服务器端控件。但是,您可以从服务器端注册JavaScriptalert()函数,该函数实际上充当消息框。 :)这里是代码...

Web application is all about HTML and JavaScript. Here there is no messagebox equivalent server side control. However you can register a JavaScript "alert()" function from server side which virtually acts as messagebox. :) here is code...
//
Page.RegisterClientScriptBlock("MyScript", "<script>alert('Data saved successfully')</script>");
// OR
ClientScript.RegisterClientScriptBlock(this.GetType(), "MyScript", "<script>alert('Data saved successfully')</script>", false);


我记得几年前从Windows到Web,发现它们非常非常不同。网络要困难得多。



不,没有简单的消息框。必须从客户端完成。了解jQuery,它会对你有所帮助。实际上有许多不错的jQuery插件用于显示对话框消息。
I remember going from Windows to Web years ago and finding them to be very, very different. The web is much more difficult.

And no, no simple messagebox. Has to be done from client side. Get to know jQuery, it will help you a lot. In fact there are many nice jQuery plugins for showing dialog messages.


JQUERY:



http://www.aspdotnet-suresh.com/2013/03/open-show- jquery-popup-window-on-page.html [ ^ ]



代码落后:



http://www.aspsnippets.com/Articles/Open-New-Window-from-Server-Side-Code-Behind-in-ASPNet-using-C-and-VBNet.aspx [ ^ ]
JQUERY :

http://www.aspdotnet-suresh.com/2013/03/open-show-jquery-popup-window-on-page.html[^]

Code behind :

http://www.aspsnippets.com/Articles/Open-New-Window-from-Server-Side-Code-Behind-in-ASPNet-using-C-and-VBNet.aspx[^]


这篇关于在asp.net中创建一个消息框(c#)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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