简体   繁体   English

从数据库检索数据的高级方法

[英]Advanced method for retrieving data from the database

In my site, I'm using update panel in the master page. 在我的网站上,我正在使用母版页中的“更新”面板。 Half of my web page will retrieve the data from the database in dynamic. 我的网页的一半将动态地从数据库中检索数据。 As, my update panel is in master page(with ajax loader), it is taking much time for every event. 因为,我的更新面板在母版页(带有ajax加载器)中,所以每个事件花费很多时间。 Is there any other advanced method to get the data from the database instead of using update panel.. Or any other idea instead of this? 是否有任何其他高级方法可以从数据库获取数据,而不是使用更新面板。或者还有其他替代方法吗?

I think you need to profile to see where the bottleneck is; 我认为您需要剖析瓶颈所在; I expect you have unnecessary code going on in your aspx that isn't really needed for the UpdatePanel . 希望您的aspx中有不必要的代码,而UpdatePanel确实不需要这些代码。

Personally, I wouldn't use UpdatePanel now; 就个人而言,我现在不会使用UpdatePanel I'd use a simple (but separate) page (or route, if using MVC) that just does the code needed for this work, and use jQuery to load it. 我将使用一个简单的页面(或单独的页面)(如果使用MVC,则为路由),该页面完成此工作所需的代码,并使用jQuery进行加载。

I think you want to load your web page from database table which contains html. 我认为您想从包含html的数据库表中加载网页。 If it is so then the best idea would be to create controls for headers/ footers or repeated sections and use caching which would reduce the load time of your web pages. 如果是这样,那么最好的办法就是为页眉/页脚或重复的节创建控件,并使用缓存来减少网页的加载时间。

You could easily cache your controls. 您可以轻松地缓存控件。 You can check here http://msdn.microsoft.com/en-us/library/aa478965.aspx 您可以在此处查看http://msdn.microsoft.com/zh-cn/library/aa478965.aspx

Happy coding 快乐编码

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM