How to get rss feed of google News or other XML in

Create a gridview in your html as follows:

      <asp:GridView ID="gvln1" runat="server" AutoGenerateColumns="False" 
            CellPadding="1" ForeColor="#333333"
            GridLines="None" Style="position: static" 
             EmptyDataText="Unable to Fetch News Item from Internet.Please Try Again Later." Font-Size="12px" Width="180px" BorderColor="#3399FF" 
                      BorderStyle="Dotted" BorderWidth="0px" AllowPaging="true" 
             ShowHeader="False"  Caption="Source: Google News">
            <FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
                <PagerSettings Visible="False" />
                <RowStyle BackColor="#F7F6F3" ForeColor="#333333" />

          <asp:TemplateField  ShowHeader="False">
                 <%# XPath("item")%><br />
               <a href="<%# XPath("link")%>" style="text-decoration:none;" target="_blank"> <%# XPath("title")%></a>
               - <font color="#ADADAD" size="1"><%# XPath("pubDate")%></font>
               <br /> 
              <HeaderStyle HorizontalAlign="Left" />
              <ItemStyle HorizontalAlign="Left" />
                <SelectedRowStyle BackColor="#E2DED6" Font-Bold="True" ForeColor="#333333" />
                <HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
                <EditRowStyle BackColor="#999999" />
                <AlternatingRowStyle BackColor="White" ForeColor="#284775" />

Now in code behind create a function and call it like this with url and gridview as parameters:
 getRSSFeed("", gvln1)

Private Function getRSSFeed(ByVal url As String, ByVal gvLiveNews As GridView) As String
        Dim cachename = "news"
        Dim myxml As XmlDataSource = New XmlDataSource

        If IsNothing(Cache(cachename)) Then
            '  div_err.InnerHtml = "if cache is null then fetch"
            myxml = New XmlDataSource  'myxml is null so reset it
            myxml.DataFile = url
            myxml.XPath = "rss/channel/item"

                Cache.Insert(cachename, myxml, Nothing, Now.AddMinutes(20), TimeSpan.Zero)
                'nameof ur cache, datasource, null , no of minutes or hours to survive, timespan
                gvLiveNews.DataSource = myxml
                '  lbError.Visible = False
                Return "1"
            Catch ex As Exception
                'gvLiveNews.Visible = False
                Return "Unable to get Portion of Live News Feed from internet. Service shall be restored shortly."
            End Try
            myxml = CType(Cache.Item(cachename), XmlDataSource)
            '  div_err.InnerHtml = "Getting from cache"
            gvLiveNews.DataSource = myxml
            Return "1"
        End If
    End Function



Most Viewed Post

solution for facebook waiting

Connect Sony XPLOD MEX-BT2500 Bluetooth CD Receiver with ur mobile

Crystal Report : Show data horizontally (Left to right) i.e. columns as rows

Google+ Followers