ҡդӶ ʵŧ 纺촨շ٨絴͵ ᷹ФѺ

͵Դҷҧ Inbox Ѻ

˹ѡ
-
VB 6/VB.Net
ASP/ASP.Net
Ѻ¤
¹ҹ Flash Movie
ռͺش  
 RSS Feeds
 ǹŴ RSS Reader ...   Download  RSS Reader

Forum - www.g2gnet.com
Webmaster - www.g2gnet.com
Visitors - Session views
 5 6 1 6 1 0 6

7 ѹҤ ..2549
60 Users On-Line.
Visitors - Page views
 8 9 7 3 8 4 9
1 Ҿѹ ..2551

Google   
g2gnet.com
Ҵѡ:  

ASP.Net 硾ԡ˹ٷӡҹҨҡ RSS Feed (ٻẺ XML)

Category »  ASP/ASP.Net
: Webmaster 10/11/2549 7:37:00
(ҹ : 25076) 

ٻẺ·仢ͧ͡ XML Ѻͧ (ǡѺ XML ...)

<rss version="2.0">
  <channel>
    <title>Channel title</title>
    <link>URL</link>
    ...
    
    <item>
      <title>Title for Syndicating Content Item #1</title>
      <link>Link to Content Item #1</link>
      ...
    </item>
    <item>
      <title>Title for Syndicating Content Item #2</title>
      <link>Link to Content Item #2</link>
      ...
    </item>
    ...
    <item>
      <title>Title for Syndicating Content Item #N</title>
      <link>Link to Content Item #N</link>
      ...
    </item>
  </channel>
</rss>

չҴ ASP.Net ӡҹ RSS Feed ٻẺͧ XML

<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.Xml" %>
<script language="VB" runat="server">
Sub Page_Load(sender as Object, e as EventArgs)    
    ' 觤ҵ˹觢ͧ XML ѧ GetRSSFeed յ strURL  Argument Ѻ
    recentPosts.DataSource = GetRSSFeed("http://www.g2gnet.com/News/NewsIT.xml")
    recentPosts.DataBind()      
End Sub

Function GetRSSFeed(strURL as String) as DataTable ' 觤ҡѺ繵ҧ
    ' ҡѺͧ Ӣŷ RSS Feed (ٻẺͧ XML) ҡ觷ҵͧҡ˹Ѻ xmlTextReader
    Dim reader as XmlTextReader = New XmlTextReader(strURL)
    
    Dim ds as DataSet = New DataSet()
    ds.ReadXml(reader)    
    Return ds.Tables(2)
End Function
</script>

<asp:DataGrid runat="server" id="recentPosts" />
ͺ÷ӧҹ
XML

㨧¤Ѻͧ ... ѹդШҧͧͧ Web Services բ鹤͹ҧҡ¤Ѻ (Դͧ 55555)

ӡûѺا䢡ʴٴժҵԵСšѹաѡԴ֧Ѻͧ ...
ҡ÷Ѵҹ <asp:DataGrid runat="server" id="recentPosts" /> ӡ

'  Ѻا͡ʴҡ Content ١ XML
<asp:DataGrid runat="server" id="recentPosts" AutoGenerateColumns="False"
     Font-Name="Tahoma" Font-Size="10pt"
     HeaderStyle-Font-Bold="True"
     HeaderStyle-HorizontalAlign="Center"
     HeaderStyle-BackColor="Navy" HeaderStyle-ForeColor="White"
     HeaderStyle-Font-Size="15pt"
     AlternatingItemStyle-BackColor="#eeeeee">
  <Columns>
    <asp:TemplateColumn HeaderText="Read XML By ASP.Net DEMO">
      <ItemTemplate>
	  	' ҹ駤
        <a href="<%# DataBinder.Eval(Container.DataItem, "link")%>" target="_blank">
		' ҹ Title
          <%# DataBinder.Eval(Container.DataItem, "title") %>
' ҹ Description <%# DataBinder.Eval(Container.DataItem, "Description") %> ' ҵͧ .... </ItemTemplate> </asp:TemplateColumn> </Columns> </asp:DataGrid>
ͺ÷ӧҹ

͵ - g2gNet Dot Com
Ţ¹ҳԪ硷͹ԡ 0407314800231
CopyLeft © 2004 - 2099 g2gNet.Com All rights reserved.
Email: [email protected] . 08-6862-6560