Click here to Skip to main content
Click here to Skip to main content Currency Exchange Rate via RSS

, 20 Jun 2007
Rate this:
Please Sign up or sign in to vote.
This articles is to explain the use on live XML for displaying data. I have used Exchange Rates from to show one of many use of this technique. I have used bit of comments to explain how this code is working.


This code uses an RSS feed offering the latest currency exchange rates and pulls data from it when the user clicks a Fetch button. The user is able to choose a currency for which to fetch exhange rates on. This code is useful since it fetches up-to-date details on currency exchange rates - something which is ever more expected of systems that deal with commercial applications.


This code uses ASP .Net 2.0, C# 2.0 and also demonstrates the usefulness of Prototype.js (a third party Javascript framework).

Using the code

The codebehind code is given as reference and followed by html code

//using System;

//using System.Data;

//using System.Configuration;

//using System.Collections;

//using System.Web;

//using System.Web.Security;

//using System.Web.UI;

//using System.Web.UI.WebControls;

//using System.Web.UI.WebControls.WebParts;

//using System.Web.UI.HtmlControls;

//using System.Xml;

//public partial class Modules_LiveExchangeRates : System.Web.UI.Page


// protected void Page_Load(object sender, EventArgs e)

// {

// if (!Page.IsPostBack)

// {

// }

// }

// private void PopulateGrid(string vstrURL)

// {

// if (lstExchange.Items.Count > 0)

// {

// lstExchange.Items.Clear();

// }

// XmlDocument objDoc = new XmlDocument();

// objDoc.Load(vstrURL);

// XmlNodeList objNL;

// if (null != objDoc)

// {

// objNL = objDoc.SelectNodes("rss/channel/item");

// if (null != objNL)

// {

// foreach (XmlNode XNode in objNL)

// {

// lstExchange.Items.Add(XNode.ChildNodes[0].InnerText);

// } 

// }

// }

// }

// protected void btnFetchValue_Click(object sender, EventArgs e)

// {

// PopulateGrid(txtURL.Text.Trim());

// }





//----------- HTML Code

 //<html xmlns="<a href=""></a>" >
//<head id="Head1" runat="server">
//    <title>Page</title>
//    <link href="../Styles/StyleSheet.css" rel="stylesheet" type="text/css" />
//    <script type="text/javascript" src="../scripts/prototype.js"></script>

//    <script type="text/javascript"> 
//    <!--
//function Rvalue() {
//  document.getElementById("rssText").innerHTML = "Copy URL into RSS Application...<br>" + document.frmPage["rss"].value;
//  $("txtURL").value=$("rss").value;
//--> </script> <style type="text/css"> <!--
//.graybox {
//border: solid 1px gray;

//#graybox {
//border: solid 1px gray;

//.rssText {  
//    font-family: Arial, Helvetica, sans-serif; font-size: 0.8em; color: #333399;

//#smlink {
//font-size: .6em;
//color: #dedede;
//font-style: normal;
//font-family: Arial, Helvetica, sans-serif;

//#smlink a:link,#smlink a:visited{
//color: #7e7e7e; /*Was #dedede.*/
//text-decoration: none; }

//#smlink a:hover {
//color: #7e7e7e; 
//text-decoration: underline}
//--> </style>

//    <form id="frmPage" runat="server">
//    <table id="tblMain" style="width:100%" class="tablebdr1">
//    <tr>
//    <td style="height:20px" class="textorg">Live Exchage Rates</td>

//    </tr>
//    <tr>
//    <td style="height:20px"></td>

//    </tr>

//    <tr>
//    <td>
// <table border="0" cellspacing="2" cellpadding="2" id="graybox" style="width: 273px; height: 74px"> 
// <tr> <td class="textorg"><div align="center">
//    Currency Exchange Rates via <b>RSS</b></div></td></tr><tr><td>
//<select name="rss" onchange="javascript:Rvalue()">
//    <option value="0" selected="selected">Select a Currency...</option>
//    <option value="<a href="">">Argentine</a> Peso</option>
//    <option value="<a href="">">Australian</a> Dollar</option>
//    <option value="<a href="">">Bahrain</a> Dinar</option>
//    <option value="<a href="">">Botswana</a> Pula</option>
//    <option value="<a href="">">Brazilian</a> Real</option>
//    <option value="<a href="">">Brunei</a> Dollar</option>
//    <option value="<a href="">">Canadian</a> Dollar</option>
//    <option value="<a href="">">Chilian</a> Peso</option>
//    <option value="<a href="">">Chinese</a> Yuan</option>
//    <option value="<a href="">">Colombian</a> Peso</option>
//    <option value="<a href="">">Cyprus</a> Pound</option>
//    <option value="<a href="">">Czech</a> Koruna</option>
//    <option value="<a href="">">Danish</a> Krone</option>
//    <option value="<a href="">">Euro</option</a>>
//    <option value="<a href="">">Hungarian</a> Forint</option>
//    <option value="<a href="">">Icelandic</a> Krona</option>
//    <option value="<a href="">">Indian</a> Rupee</option>
//    <option value="<a href="">">Indonesian</a> Rupiah</option>
//    <option value="<a href="">">Iranian</a> Rial</option>
//    <option value="<a href="">">Israeli</a> New Sheqel</option>
//    <option value="<a href="">">Japanese</a> Yen</option>
//    <option value="<a href="">">Korean</a> Won</option>
//    <option value="<a href="">">Kuwaiti</a> Dinar</option>
//    <option value="<a href="">">Libyan</a> Dinar</option>
//    <option value="<a href="">">Malaysian</a> Ringgit</option>
//    <option value="<a href="">">Maltese</a> Lira</option>
//    <option value="<a href="">">Mauritian</a> Rupee</option>
//    <option value="<a href="">">Mexican</a> Peso</option>
//    <option value="<a href="">">Nepalese</a> Rupee</option>
//    <option value="<a href="">">New</a> Zealand Dollar</option>
//    <option value="<a href="">">Norwegian</a> Krone</option>
//    <option value="<a href="">">Omani</a> Rial</option>
//    <option value="<a href="">">Pakistan</a> Rupee</option>
//    <option value="<a href="">">Polish</a> Zloty</option>
//    <option value="<a href="">">Pound</a> Sterling</option>
//    <option value="<a href="">">Qatar</a> Riyal</option>
//    <option value="<a href="">">Saudi</a> Arabian Riyal</option>
//    <option value="<a href="">">Singapore</a> Dollar</option>
//    <option value="<a href="">">Slovenian</a> Tolar</option>
//    <option value="<a href="">">South</a> African Rand</option>
//    <option value="<a href="">">Sri</a> Lanka Rupee</option>
//    <option value="<a href="">">Swedish</a> Krona</option>
//    <option value="<a href="">">Swiss</a> Franc</option>
//    <option value="<a href="">">Thai</a> Baht</option>
//    <option value="<a href="">">Trinidad</a> & Tobago Dollar</option>
//    <option value="<a href="">">U.A.E</a>. Dirham</option>
//    <option value="<a href="">">U.S</a>. Dollar</option>
//    <option value="<a href="">">Venezuelan</a> Bolivar</option>
//    </tr>
//     <tr style="display:none">
// <td>
//     <div align="left">
//     </div>
//     <div id="rssText" align="left" class="textorg">

//// URL:
//     </div>
//     <asp:TextBox ID="txtURL" runat="server" Text=""></asp:TextBox>
// </td>
//     </tr>

//  </table>
//  <!-- That's it! Your site visitors now have access to continuously updated Currency Exchange Rates via RSS! --> 
//<asp:Button ID="btnFetchValue" runat="server" Text="Fetch Value" OnClick="btnFetchValue_Click" /></td>
//    </tr>

//     <tr>
//    <td>
//    <asp:ListBox ID="lstExchange" runat="server" Width="363px" Height="456px"></asp:ListBox>
//    </td>

//    </tr>

//    </table>
//    </form>



Remember to set the Language of your code snippet using the Language dropdown.

Use the "var" button to to wrap Variable or class names in <code> tags like this.


This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


About the Author

Suvendu Banik
Program Manager
India India
Love to code

Comments and Discussions

GeneralRSS Feeds now require a password Pinmemberstapes22-Feb-11 4:24 
GeneralDoesn't work Pinmemberstapes22-Feb-11 4:17 
GeneralOld exchange rates PinmemberZahid Rasool31-Oct-08 11:03 
GeneralGood information Pinmemberfriendz4u12-Jul-07 1:03 
Jokeugh PinmemberMatthew Hazlett25-Jun-07 19:37 
Generalcomment PinmemberRepliCrux20-Jun-07 21:49 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Terms of Use | Mobile
Web04 | 2.8.150123.1 | Last Updated 21 Jun 2007
Article Copyright 2007 by Suvendu Banik
Everything else Copyright © CodeProject, 1999-2015
Layout: fixed | fluid