本文介绍了在Rebind()或Paging之后,Radgrid中的Javascript无法正常工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Telerik Radgrid中使用Javasript(倒计时脚本)时遇到一些错误。

如果符合我的条件,Grid的每一行都有一个倒计时脚本。所以我在添加脚本之前检查每一行的条件。



我使用来自http://keith-wood.name/countdown.html的Jquery倒计时插件

我使用asp:UpdatePanel来包装Radgrid。

里面Ragrid,我有一个显示倒计时的面板。



在事件Radgrid Itemdatabound,我检查条件,倒计时日期更大比当前日期,如果是真的我添加到脚本。



问题是:



- ragrid(分页)的第一页没问题,但第二页的倒计时显示错误。

- 请查看网站上的源代码并找到lblCountDownScript,你可以看到下面的脚本与两页(分页)相同。



I have some errors when using Javasript(countdown script) inside Telerik Radgrid.
Each row of Grid has a countdown script if it is true with my condition. So I check condition each row before adding script.

I use Jquery countdown plugin from http://keith-wood.name/countdown.html
I use asp:UpdatePanel to wrap Radgrid.
Inside Ragrid, I have a panel to display countdown.

At event Radgrid Itemdatabound, I check condition that Date of Countdown greater than current Date, if it true I add to an script.

The problem is:

- The first page of ragrid(paging) is ok, but the second page has wrong countdown display.
- Please view source code from website and find lblCountDownScript, you can see the below script same as two pages(paging).

<span id="MainContent_lblCountDownScript"><script type='text/javascript'>function pageLoad() {var austDay = new Date();austDay = new Date(2014,0,22,11,13,7);$('#MainContent_radGrid_ctl00_ctl04_pnlCountDown').countdown({ until: austDay,format: 'HMS',compact: true,description: ''});$('#year').text(austDay.getFullYear());var austDay = new Date();austDay = new Date(2014,0,24,11,13,7);$('#MainContent_radGrid_ctl00_ctl06_pnlCountDown').countdown({ until: austDay,format: 'HMS',compact: true,description: ''});$('#year').text(austDay.getFullYear());};</script></span>







在我的附件中,有一个示例项目:

- 倒计时行有红色列'日期时间',倒计时时间低于时间

- 没有计数wn row有黑色列'Datetime',黑色列'Countdown'

- 你可以查看第1页和第2页,它们与倒计时脚本相同。



*如果我删除更新面板,它可以工作,但由于某些原因我无法删除它。



请查看它并让我知道如何解决我的问题。我需要你的帮助,谢谢!



非常感谢




In my attach file, there is an example project: Download from Mediafire
- The countdown row has red column 'Datetime', and has Countdown time below the time
- The no countdown row has black column 'Datetime', and black column 'Countdown'
- You can view page 1 and page 2, they are the same as countdown script.

* If I remove Update panel, it works, but I can not remove it for some reasons.

Please view it and let me know how to fix my problem. I need your help, thanks!

Thanks so much

推荐答案




这篇关于在Rebind()或Paging之后,Radgrid中的Javascript无法正常工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-27 12:01