2013-03-14 60 views
0
客户端

你好,我想使用jquery或javscript重新加载在规则的时间间隔后,客户端将DataList这样我可以在这里最新的RSS新闻是我的代码Realod DataList控件上的XmlDataSource

<asp:XmlDataSource ID="XmlDataSource1" runat="server" DataFile="http://www.example.com/category/test/feed/" 
    XPath="rss/channel/item"></asp:XmlDataSource> 
<asp:DataList ID="dlRss" runat="server" DataSourceID="XmlDataSource1"> 
    <ItemTemplate> 
     <label style="color: #222222; float: left; font-size: 16px; margin-top: 5px; width: 190px;"> 
     <%# XPath("title")%></label> 
     <label style="color: #444444; display: inline-block; font-size: 11px; margin-bottom: 5px; 
     width: 190px;"> 
     <%# Convert.ToDateTime(XPath("pubDate")).ToShortDateString() + " @" + Convert.ToDateTime(XPath("pubDate")).ToShortTimeString()%></label> 
     <label style="color: #444444; display: inline-block; font-size: 13px; width: 190px;"> 
     <%#XPath("description").ToString().Length <= 200 ? XPath("description") : XPath("description").ToString().Substring(0,200) + "...<a href='" + XPath("link").ToString() + "' target='_blank'>more</a>"%></label> 
     <br /> 
    </ItemTemplate> 
</asp:DataList> 

回答

1

您不能在客户端设置DataSource
但你可以做的是这个reload你的网页在特定的时间间隔之后。
否则你将不得不使用http处理程序与jtemplate和jquery。

这里有一些链接可以帮助您
http://johnnycoder.com/blog/2008/12/18/jtemplates-with-jquery-ajax-and-json/
http://www.dotnetcurry.com/ShowArticle.aspx?ID=573

+0

谢谢,我想我应该用JSON和WedMehtods绑定DataList控件,因为页面是非常沉重的,我不想重装整个页面 – 2013-03-14 06:36:08