2013-03-14 61 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