MoneyConvert.aspx
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="MoneyConvert.aspx.cs"
Inherits="MoneyConversion.MoneyConvert" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
Enter Amount in Rupees: <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
</div> <p>
<asp:Button ID="Button1" runat="server" OnClick="Button1_Click" Text="US Dollers" />
<asp:Label ID="Label1" runat="server" Text=""></asp:Label>
</p>
<p>
<asp:Button ID="Button2" runat="server" OnClick="Button2_Click" Text="Euros" Width="91px" />
<asp:Label ID="Label2" runat="server" Text=""></asp:Label>
</p>
</form> </body>
</html>
MoneyConvert.aspx.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace MoneyConversion
{
public partial class MoneyConvert : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void Button1_Click(object sender, EventArgs e)
{
Convertion s = new Convertion();
double r = Convert.ToDouble(TextBox1.Text);
double rate = s.doller(r);
Label1.Text = rate.ToString();
}
protected void Button2_Click(object sender, EventArgs e)
{
Convertion s = new Convertion();
double r = Convert.ToDouble(TextBox1.Text);
double rate = s.euros(r);
Label2.Text = rate.ToString();
}
}
public class Convertion
{
public double doller(double r)
{ r = r * 0.015;
return r;
}
public double euros(double r)
{ r = r * 0.012;
return r;
}
}
}
0 Comments