forked from srikanthpragada/webdemo_10_july_2019
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcurrency.aspx.cs
35 lines (33 loc) · 992 Bytes
/
currency.aspx.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace WebDemo
{
public partial class currency : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (Page.IsPostBack)
Response.Write("Postback request");
else
Response.Write("Direct request");
}
protected void btnConvert_Click(object sender, EventArgs e)
{
try
{
int amount = Int32.Parse(txtAmount.Text);
int rate = Int32.Parse(ddlCurrency.SelectedItem.Value);
amount = amount / rate;
lblUSD.Text = amount + " " + ddlCurrency.SelectedItem.Text;
}
catch(FormatException ex)
{
lblUSD.Text = "Sorry! Invalid number. Please enter valid number!";
}
}
}
}