asp.net多个updatepanels持有带有jquery部分回发问题的usercontrols

时间:2021-12-11 03:38:57

I have a page with several user controls in different updatepanels. The user controls includes jquery calls which are used to calculate some values and draw graphs(no server methods are called from jquery).

我有一个页面,在不同的updatepanels中有几个用户控件。用户控件包括jquery调用,用于计算某些值并绘制图形(不从jquery调用服务器方法)。

The problem is that, whatever updatepanel is refreshed, all of the jquery calls are processed again. I think the problem arises because i use pageload methods of the usercontrols to do jquery method calls.

问题是,无论刷新什么updatepanel,都会再次处理所有jquery调用。我认为问题出现是因为我使用usercontrols的pageload方法来执行jquery方法调用。

I wonder whether there is a way to stop other user controls from calling their pageload methods or refreshing.

我想知道是否有办法阻止其他用户控件调用其页面加载方法或刷新。

thanks in advance.

提前致谢。

1 个解决方案

#1


0  

maybe this would help...not exactly an answer

也许这会有所帮助......不完全是答案

when you include custom controls on a page on rendering the controls HTML is included in the page as it is with all JavaScript and css( you can do a View page Source) and check that.

当您在页面上包含自定义控件时,渲染控件HTML将包含在页面中,因为它包含所有JavaScript和CSS(您可以执行View页面源)并检查它。

and so in effect there can be 3 pageloads in your page(the page that has the user controls included) in different tags and as such all are getting called when any update panel refreshes.

所以实际上你的页面中有3个页面加载(包含用户控件的页面)在不同的标签中,因此当任何更新面板刷新时都会调用它们。

#1


0  

maybe this would help...not exactly an answer

也许这会有所帮助......不完全是答案

when you include custom controls on a page on rendering the controls HTML is included in the page as it is with all JavaScript and css( you can do a View page Source) and check that.

当您在页面上包含自定义控件时,渲染控件HTML将包含在页面中,因为它包含所有JavaScript和CSS(您可以执行View页面源)并检查它。

and so in effect there can be 3 pageloads in your page(the page that has the user controls included) in different tags and as such all are getting called when any update panel refreshes.

所以实际上你的页面中有3个页面加载(包含用户控件的页面)在不同的标签中,因此当任何更新面板刷新时都会调用它们。