CodeVerge.Net Beta


   Explore    Item Entry   Register  Login  
Microsoft News
Asp.Net Forums
IBM Software
Borland Forums
Adobe Forums
Novell Forums

ASP.NET Web Hosting
3 Months Free and Free Setup - ASP.NET Web Hosting



Can Reply:  No Members Can Edit: No Online: Yes
Zone: > NEWSGROUP > Asp.Net Forum > starter_kits_and_source_projects.classifieds_starter_kit Tags:
Item Type: NewsGroup Date Entered: 3/2/2008 5:16:15 PM Date Modified: Subscribers: 0 Subscribe Alert
Rate It:
NR
XPoints: N/A Replies: 7 Views: 40 Favorited: 0 Favorite
8 Items, 1 Pages 1 |< << Go >> >|
etha66
Asp.Net User
Allow users choosing currencies3/2/2008 5:16:15 PM

0

Hi all.

1) In the post page,near the price box, i want to add a dropdownlist with several currencies e;g ?,$;euros..., to allow users to choose the currency they want for theire transactions.

2) And in the show ads page,and search ..i want the currency choosen ,beeing displayed beside the price amount.

How to do that?

( sorry for my bad english writing)

gopalanmani
Asp.Net User
Re: Allow users choosing currencies3/2/2008 6:01:28 PM

0

hi,

A Web Forms Currency Converter

Figure 5-9 shows a Web form that performs currency conversions using exchange rates stored in an XML file. To see it in action, copy Converter.aspx and Rates.xml, which are listed in Figures 5-10 and 5-11, to \Inetpub\wwwroot and type http://localhost/converter.aspx in your browser's address bar. Then pick a currency, enter an amount in U.S. dollars, and click the Convert button to convert dollars to the currency of your choice.

Here are some points of interest regarding the source code:

  • Because it uses the DataSet class defined in the System.Data namespace, Converter.aspx begins with an @ Import directive importing System.Data.

     

  • Rather than show a hard-coded list of currency types in the list box, Converter.aspx reads them from Rates.xml. Page_Load reads the XML file and initializes the list box. To add new currency types to the application, simply add new Rate elements to Rates.xml. They'll automatically appear in the list box the next time the page is fetched.

     

  • For good measure, Converter.aspx wires the Convert button to the Click handler named OnConvert programmatically rather than declaratively. The wiring is done in Page_Init.

     

Notice how easily Converter.aspx reads XML from Rates.xml. It doesn't parse any XML; it simply calls ReadXml on a DataSet and provides an XML file name. ReadXml parses the file and initializes the DataSet with the file's contents. Each Rate element in the XML file becomes a row in the DataSet, and each row, in turn, contains fields named "Currency" and "Exchange". Enumerating all the currency types is a simple matter of enumerating the DataSet's rows and reading each row's "Currency" field. Retrieving the exchange rate for a given currency is almost as easy. OnConvert uses DataTable.Select to query the DataSet for all rows matching the currency type. Then it reads the Exchange field from the row returned and converts it to a decimal value with Convert.ToDecimal.

One reason I decided to use a DataSet to read the XML file is that a simple change would enable the Web form to read currencies and exchange rates from a database. Were Converter.aspx to open the XML file and parse it using the FCL's XML classes, more substantial changes would be required to incorporate database input.

A word of caution regarding this Web form: Don't use it to perform real currency conversions! The exchange rates in Rates.xml were accurate when I wrote them, but they'll be outdated by the time you read this. Unless you devise an external mechanism for updating Rates.xml in real time, consider the output from Converter.aspx to be for educational purposes only.

  

Converter.aspx

<%@ Import Namespace=System.Data %>
 
<html>
  <body>
    <h1>Currency Converter</h1>
    <hr>
    <form runat="server">
      Target Currency<br>
      <asp:ListBox ID="Currencies" Width="256" RunAt="server" /><br>
      <br>
      Amount in U.S. Dollars<br>
      <asp:TextBox ID="USD" Width="256" RunAt="server" /><br>
      <br>

      <asp:Button Text="Convert" ID="ConvertButton" Width="256"
        RunAt="server" /><br>
      <br>
      <asp:Label ID="Output" RunAt="server" />
    </form>
  </body>
</html>
 
<script language="C#" runat="server">
  void Page_Init (Object sender, EventArgs e)
  {
      // Wire the Convert button to OnConvert
      ConvertButton.Click += new EventHandler (OnConver t);
  }
 
  void Page_Load (Object sender, EventArgs e)
  {
      //  If this isn't a postback, initialize the ListBox
      if (!IsPostBack) {
          DataSet ds = new DataSet ();
          ds.ReadXml (Server.MapPath ("Rates.xml"));
          foreach (DataRow row in ds.Tables[0].Rows)
              Currencies.Items.Add (row["Currency"].ToS tring ());
          Currencies.SelectedIndex = 0;
      }
  }
 
  void OnConvert (Object sender, EventArgs e)
  {
      // Perform the conversion and display the results
      try {
          decimal dollars = Convert.ToDecimal (USD.Text );
          DataSet ds = new DataSet ();
          ds.ReadXml (Server.MapPath ("Rates.xml"));
          DataRow[] rows = ds.Tables[0].Select 
         ("Curren cy = '" +
              Currencies.SelectedItem.Text + "'");
          decimal rate = Convert.ToDecimal (rows[0]
         ["Ex change"]);
          decimal amount = dollars * rate;
          Output.Text = amount.ToString ("f2");
      }
      catch (FormatException) {
          Output.Text = "Error";
      }
  }
</script>

 

Rates.xml

<?xml version="1.0"?>
<Rates>
  <Rate>
    <Currency>British Pound</Currency>
    <Exchange>0.698544</Exchange>
  </Rate>

  <Rate>
    <Currency>Canadian Dollar</Currency>
    <Exchange>1.57315</Exchange>
  </Rate>
  <Rate>
    <Currency>French Franc</Currency>
    <Exchange>7.32593</Exchange>
  </Rate>
  <Rate>
    <Currency>German Mark</Currency>
    <Exchange>2.18433</Exchange>
  </Rate>
  <Rate>
    <Currency>Italian Lira</Currency>
    <Exchange>2162.67</Exchange>
  </Rate>
  <Rate>
    <Currency>Japanese Yen</Currency>
    <Exchange>122.742</Exchange>
  </Rate>
  <Rate>
    <Currency>Mexican Peso</Currency>
    <Exchange>9.22841</Exchange>
  </Rate>
  <Rate>
    <Currency>Swiss Franc</Currency>
    <Exchange>1.64716</Exchange>
  </Rate>
</Rates>

 

etha66
Asp.Net User
Re: Allow users choosing currencies3/2/2008 7:03:25 PM

0

Thanks,

 but i need just to allow users choose the currency they want to use, not the rate. i.e USD,EURO,LIRA, ...just a little currency dropdownlist beside the price. and in the show page the price and the currency as posted.

manorfarm
Asp.Net User
Re: Allow users choosing currencies3/2/2008 10:00:55 PM

0

Hi

Check this http://forums.asp.net/t/1214962.aspx and read darkknight187 reply at the end of page

It helped me add several controls

This is a great explanation of how to add columns to you database and retrieve them later on another page

The easy bit is to add a ddl to Post add and an asp:label to Showad but there is quite a bit of work to do to achieve it the result you are looking for

 

 

 

 

darkknight187
Asp.Net User
Re: Allow users choosing currencies3/3/2008 3:00:30 PM

0

Thanks manarfarm,

You could also play with the themes to determine what currency to use.

But the quickest is probably just add the ddl and store the values in a column in the database.

Then use if statements or a function to return a symbol if CurencyId = 1, or what ever it may be.


Be sure to visit www.detelli.com to find and list your Houses for rent

And please remember to click ?Mark as Answer? on the post that helps you.
This can be beneficial to other community members reading the thread.
etha66
Asp.Net User
Re: Allow users choosing currencies3/3/2008 5:49:08 PM

0

Thanks!

I'll try it, and will see...

etha66
Asp.Net User
Re: Allow users choosing currencies3/3/2008 5:56:43 PM

0

Hi again!

I've done as you said, i've adde a DDL in the post page, and gave value to listitems :USD,Euros,.., but when i want to update the fields "currency" that i've created in the adsDataTable, it doesn't work . in the assistant of the query i've a message like following :

Update currency

set value () .  what i've to do after?

elqlippoth
Asp.Net User
Re: Allow users choosing currencies3/20/2008 4:52:13 AM

0

This is actually quite impressive, I like the use of the dataset in this way. I'm working on a project where USD, Euro, and L$ are converted as part of the POS. This will adapt nicely to that I think. I'll update here with a link when we finally get it up and running. Big Smile


Uh huh
8 Items, 1 Pages 1 |< << Go >> >|


Free Download:

Books:
Business and Work in the Information Society: New Technologies and Applications Authors: Jean-Yves Roger, Brian Stanford-Smith, Paul T. Kidd, Pages: 942, Published: 1999
The Seventh Workshop on Hot Topics in Operating Systems: HotOS-VII : 29-30 March 1999, Rio Rico, Arizona Authors: IEEE Computer Society Technical Committee on Operating Systems, IEEE Computer Society Technical Committee on Operating Systems, IEEE Xplore (Online service), Pages: 197, Published: 1999
Currency Trading for Dummies Authors: Mark Galant, Brian Dolan, Pages: 360, Published: 2007
Beginning ASP.NET 3.5 in C# 2008: From Novice to Professional Authors: Matthew MacDonald, Pages: 954, Published: 2007
Beginning ASP.NET 2.0 in VB 2005: From Novice to Professional Authors: Matthew MacDonald, Pages: 1063, Published: 2006
MCAD Developing and Implementing Web Applications with Microsoft Visual C#(TM) . NET and Microsoft Visual Studio(R) . NET Exam Cram 2 (Exam Cram 70-315): Exam Cram 2, McAd Exam 70-315 Authors: Kirk Hausman, Amit Kalani, Ed Tittel, Pages: 600, Published: 2003
Smarter Trading: Improving Performance in Changing Markets Authors: Perry J. Kaufman, Pages: 252, Published: 1995
Beginning ASP.NET 3.5 in VB 9.0: From Novice to Professional Authors: Matthew MacDonald, Pages: 1149, Published: 2007
Windows 2000 Professional: Cram 2, (Exam Cram 70-210) Authors: Dan Balter, Dan Holme, Todd Logan, Laurie Salmon, Ed Tittel, Pages: 464, Published: 2003
European Capital Markets with a Single Currency: a report of the European Capital Markets Institute Authors: Jean Dermine, Dermine, Jean, Pierre Hillion, European Capital Markets Institute, Pages: 362, Published: 1999

Web:
Allow users choosing currencies - ASP.NET Forums 1) In the post page,near the price box, i want to add a dropdownlist with several currencies e;g £,$;euros..., to allow users to choose the ...
CellarTracker! Wiki - Auto Valuation In the future we hope to extend the site to allow users to choose currencies per -purchase and also to do currency conversion between the supported ...
Currency Internationalization (i18n), Multi-currency architecture ... Some software applications allow for 15 characters in currency names. Long text strings are good for specificity, but difficult for users to enter. ...
Write a Currency Conversion Program in C 1.code that will limit type of currency to 1-5 only, if user entered over 5 it should have invalid input and ask user to choose type of currency again. ...
Tickets and Currencies Revisited: Extensions to Multi-Resource ... tem might choose to fund each user’s applications with ..... method could allow. users to issue base currency tickets, provided that the sum ...
D-Mack Joomla! DownLoads Description: Component to allow your users to determine currency conversions ... to obtain the conversion rates and has 147 denominations to choose from. ...
PPCSG > Free Currency Convertor Select currencies used for last conversion on program start. - Allow users to choose where to save currency file. ...
Tickets and Currencies Revisited: Extensions to Multi-Resource ... To solve this problem, a grafted version of the base-currency broker's may_issue () method could allow users to issue base currency tickets, provided that ...
Multiple currencies for products | Ubercart ... is it possible to set prices for a product in Euros and GB Pounds (say), and allow the user to choose which currency they wish to use?
Introduction of Euro and OANDA Currency Services This is to allow users to perform historical exchange requests for these .... will be equivalent in choosing Euro as the desired currency (home or base). ...

Videos:
ZohoCreator Problems With Lookup Fields ZohoCreator Problems With Lookup Fields General YouTube - ZohoCreator relationships between forms youtube.com/watch?v=WJ4222pCbI0 ZohoCreator relati...
PBS Free to Choose 1990 Vol. 3 of 5 - The Failure of Socialism Free to Choose 1990 Volume 3 - Freedom and Prosperity Topic: The Re-Birth of Freedom in Eastern Europe ABSTRACT Milton says "Everybody knows wha...
Zoho Creator UI suggestions ZohoCreator UI suggestions General YouTube - ZohoCreator relationships between forms youtube.com/watch?v=WJ4222pCbI0 ZohoCreator relationships betw...
Free.to.Choose.1990.Vol.3of5.The.Failure.of.Socialism Free to Choose 1990.Vol.3of5 The Failure of Socialism Milton Friedman
Economic Enslavement by Debt & Stupidity + Choose Freedom GoldRing DVD's Now available at http://www.premieres.com + Higher Resolution versions of each segment of the Game of Enlightenment at http://www.prem...
IGN Fable 2 Review 8.8 Xbox 360 Exclusive Set 500 years after the original game, Fable 2 offers even more choices and features, while building on the core gameplay theme of...
When I'm Gone - RuneScape Music Video For some strange reason, my computer doesn't allow high quality even with the added HMTL code. If there is a possibility for High Detail on your comp...
"Serving Two Masters" Pastor Gary Tolbert - July 22, 2006 Fletcher Seventh day Adventist Church in North Carolina. Sermon by Pastor Gary Tolbert. Seventh-day Adventists base their faith on Jesus Christ, the...
myHotelVideo.com presents: Hotel Britannia International in London / England / United Kingdom More @ http://myhotelvideo.com/de/landingpage/youtube/resourceid/Mhv_Catalog_Offer::47097 Location: This hotel is situated in an extremely convenient...
SwitchPlanet IV Revenge Of The Switch www.SwitchPlanet.com _______________________________________ Socialize -- Discover - Share Nothing brings people together more then music, movies,ga...












whats wrong with membership.validateuser?

image not visible after upload with file manager

time zone question

database table are not in correct db

evaluation site for dnn modules and skins

windows authentication, and yes i did search

rss feed module, how to only show top 5 posts?

links on the same page

differences in the pa install .dnn files between versions

file manager question?

to remove modules?

terms of use, privacy statement, etc

dnn 3.04 beta - error on rich text editor

where is a scrolling news?

3.0.10 skinning question

changing the class of a link into a links module

sliding leftpane..

problems upgrading 3.0.11 to 3.0.12

auto create private assembly

first impressions of dnn

dnn3 user guide?

xml & css issues

clarification pls - microsoft licensing and dnn

win2003 web edition & dotnetnuke204

reverse lookups

i need a solution developed

connecting dnn modules

dnn timeout error

cloneing portals (x60)

ftb link picker add-on

   
  Privacy | Contact Us
All Times Are GMT