如何使用Asp.net将数据更新到数据库时显示Popup [英] How to display the Popup when data is updated into database using Asp.net

查看:54
本文介绍了如何使用Asp.net将数据更新到数据库时显示Popup的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨朋友们,我有一个要求uisng asp.net。我希望在显示弹出窗口后在数据库中更新数据时显示弹出窗口。每次更新数据时都会显示.Popup。如何在asp.net中使用c#.net执行此要求,而不使用控件事件。在表中特定字段的数据库中更新数据时自动进入。



请任何人帮助我....

解决方案

使用UpdatePanel并在ajax完成UpdatePanel之后调用Javascript函数

有关更多信息,请通过此链接

http://eligeske.com/asp-net/call-a- javascript-on-ajax-complete-of-update-panel-2 / [ ^ ]



希望这会有所帮助


使用SignalR实现它的最佳方法。它完全免费下载。我们已将此用于类似场景。

这是网址:

http://signalr.net/ [< a href =http://signalr.net/target =_ blanktitle =New Window> ^ ]



它有一个包装好的Web Socket功能来满足这些情况。或者您可以直接使用Web套接字:



http://msdn.microsoft.com/en-in/library/ie/hh673567(v = vs.85).aspx [ ^ ]



以上是它的直接方式,但仍然有以下替代方案。



如果您使用的是4.5版本,那么你可以尝试以下方式。



。从代码需要使用需要联系到DB并等待响应的Async和Await。如果它得到了DB更新发生的响应,那么可以显示弹出窗口

。它应该是一个递归调用。我的意思是它需要通过异步调用保持开放的通信。一旦等待时间结束,另一个请求应该转到数据库。

。使用Thread或.Net的Background_Worker类可以完成同样的工作

。关键是我们需要让Thread或Background_Worker运行递归。



在这里你可以看到如何使用Async:http://msdn.microsoft.com/en-us/library/vstudio/hh191443.aspx [ ^ ]



希望这会有所帮助。



谢谢,

Siju Thomas。


最简单的解决方案。



- 实现更新逻辑,更新结束后输入以下行。



回复.Write( < script type ='text / javascript'>); 
Response.Write( alert('数据库更新成功。'););
Response.Write( < / script>);


Hi friends, I have a requirement uisng asp.net. I want to display the popup when data is updated in database after that displaying the popup .Popup will be displaying every time data is updated. How can do this requirement in asp.net with c#.net and without using events of controls. automatically coming when data is updated in database of perticular field in the table.

Please any one help me....

解决方案

Use UpdatePanel and call a Javascript function after on ajax complete of UpdatePanel
For more information go through this link
http://eligeske.com/asp-net/call-a-javascript-function-on-ajax-complete-of-update-panel-2/[^]

Hope this helps


The best way to get it implemented by using the SignalR. It is completely free to download. We have used this for similar scenarios.
Here is the url:
http://signalr.net/[^]

It is having a wrapped Web Socket functionality to meet these kind of cases. Or you can directly go for Web Sockets:

http://msdn.microsoft.com/en-in/library/ie/hh673567(v=vs.85).aspx[^]

The above are the direct ways for it but still there are alternatives as below.

If you are using the 4.5 version, then you can try the following way.

. From code need to use the Async and Await which need to contact to the DB and wait for a response. If it has got a response that an update happened in DB then can show the popup
. It should be a recursive call. I mean it need to keep open the communiction alive with the async call. Once the wait time is over another one request should go to the db.
. The samething can be done using Thread or .Net''s Background_Worker class
. The key thing is that we need to have the Thread or Background_Worker to run recursive.

Here you can see how to use Async: http://msdn.microsoft.com/en-us/library/vstudio/hh191443.aspx[^]

Hope this helps.

Thank You,
Siju Thomas.


Simplest solution.

-Implement your update logic and after the update ends put the below lines.

Response.Write("<script type='text/javascript'>");
Response.Write("alert('Database updated succesfully.');");
Response.Write("</script>");


这篇关于如何使用Asp.net将数据更新到数据库时显示Popup的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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