Hi,
Actually I have currency conversion coding from INR to USD .But it will execute in Button click only...ie we need to give the amount in INR in textbox.and while clicking submit button , it wil convert the amount into USD and will show the output.
Instead of button click event, I need to show the output while the page loaded. I set the input as static(ie textbox value I set to some value).so by taking that input it will execute and show the corresponding amount in USD.
The following is the code....I need to call a function for this conversion...
<%@ language="VBScript" %>
<html>
<head>
<title>Currency Server ASP Example 2</title>
</head>
<body>
<!-- declare application object -->
<%
Const curncsrvReturnRateString = 1
Const curncsrvReturnRateNumber = 2
Dim objApplication, objCurrencies,URL
Set objApplication =Server.CreateObject("CurrencyServer.Application")
Set objCurrencies = objApplication.ActiveCurrencies
%>
<table border=0>
<td style="visibility:hidden" ><%= objCurrencies.Count %></td></tr></table><br>
<!-- currency conversion form -->
<form onload=csexample2.asp method="POST">
<table>
<tr>
<td> </td>
<td><select name=CurrFrom style="HEIGHT: 22px; WIDTH: 166px;visibility:hidden; ">
<% For i = 1 To objCurrencies.Count
if Request.Form("CurrFrom") = "INR" then %>
<option selected><%="INR"%>
<% else %>
<option><%="INR"%>
<% end if%>
<% Next %>
</select>
</td>
<td> </td>
<td><select name=CurrTo style="HEIGHT: 22px; WIDTH: 166px;visibility:hidden;">
<% For i = 1 To objCurrencies.Count
if Request.Form("CurrTo") = "USD" then %>
<option selected><%= "USD"%>
<% else %>
<option><%= "USD"%>
<% end if%>
<% Next %>
</select></td>
</tr>
<tr>
<td>Amount to convert:</td>
<td>
<input name=FromValue value="100">
</td>
<td></td>
<td></td>
</tr>
<tr>
<td>
<input type="submit" name="Convert" value=Convert>
</td>
<td>
</td>
<td></td>
<td></td>
</tr>
<tr>
</tr>
<tr>
<% dim ToValue %>
<% dim FromValue %>
<% FromValue=Request.Form("FromValue") %>
<!-- validation of input data -->
<% if (FromValue > "") and (IsNumeric(FromValue)) then
ToValue = objApplication.Convert(Request.Form("CurrFrom"), Request.Form("CurrTo"), Request.Form("FromValue"), true, ". ", curncsrvReturnRateString)
end if %>
<!-- empty -->
<% if FromValue = "" then ToValue = "" end if %>
<!-- alpha -->
<% if not IsNumeric(FromValue) then
FromValue = ""
ToValue = ""
end if
%>
<td>Result:</td><td><input name=ToValue Value="<%=ToValue%>"></td>
<td></td>
<td></td>
<!-- free resources -->
<% Set objApplication = Nothing %>
</tr>
</table>
</form>
</body>
</html>