每当数据库更新c#时更新页面 [英] updating page whenever database updated c#

查看:123
本文介绍了每当数据库更新c#时更新页面的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

伙计我有2页page1.aspx和page2.aspx。在第1页,我将数据库和打印记录连接到page.In page2我有一个表单,我可以将新记录添加到数据库。顺便说一句,我当我按下第1页上的添加记录按钮时,在页面1内部(在特定div内)加载page2。我的问题是,当新记录添加到数据库时,我想立即更新我的页面(显示记录)。我不允许用SQLCache或SqlDependency做这个。有没有其他方法来实现这个?请告诉我一个方式我几个小时就遇到了这个问题。

Guys I have 2 pages page1.aspx and page2.aspx .In page1, I'm connecting database and printing records to page.In page2 I have a form which I can add new record to database.By the way,I'm loading page2 inside the page1(inside a specific div) when I pressed 'Add record' button on page1. My problem is,when new record added to the database,I want to update my page(showing record) immediately.And I'm not allowed to do this with SQLCache or SqlDependency.Is there another way to accomplish this?Please show me a way I'm stucked with this problem a couple of hours.

推荐答案

您应该使用SignalR,通过它可以很容易地知道何时有更新。



请参阅资源以开始使用 - https://docs.com/tadit-kumar-das/3033/real-time-notification-using-signalr [ ^ ]
You should use SignalR, by which you can easily know when there was an update.

Refer for resources to get started - https://docs.com/tadit-kumar-das/3033/real-time-notification-using-signalr[^]


好的,我解决了我的问题。我将新记录保存到数据库(使用
Ok,I solved my problem.After I saved new record to database(with


.ajax()调用),我应该调用webmethod(带
.ajax() call),I should call the webmethod(with


这篇关于每当数据库更新c#时更新页面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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