0

您好,我想在定期的时间间隔后使用 jquery 或 javscript 在客户端重新加载 Datalist,以便我可以获得最新的 RSS 新闻提要,这是我的代码

<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>
4

1 回答 1

1

您不能DataSource在客户端设置。
但是您可以做的是reload在特定时间间隔后显示您的页面。
否则,您将不得不使用带有 jtemplate 和 jquery 的 http 处理程序。

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

于 2013-03-14T06:28:28.160 回答