Current location: Hot Scripts Forums » Programming Languages » ASP.NET » getting the calculate button to work


getting the calculate button to work

Reply
  #1 (permalink)  
Old 09-29-11, 09:05 PM
beginner123 beginner123 is offline
New Member
 
Join Date: Sep 2011
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
getting the calculate button to work

hi,
i am new to web development. i have to develop a site where one can convert money from nzd and to nzd given a list of different currency. i need the calculate button to calculate the currency and convert the given amount. need to know how to go on about it.
My codes so far:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using Currency.Models;

namespace Currency.Controllers
{
[HandleError]
public class HomeController : Controller
{
public ActionResult Index()
{
financeInit();
return View();
}

public void financeInit()
{

financeEntities db = new financeEntities();
ViewData["exchrateList"] = db.exchrates.ToList();
ViewData["Convert From NZD"] = "";
ViewData["Convert To NZD"] = "";
ViewData["The other currency is:"] = "";
ViewData["You wish to convert"] = "";
ViewData["That will produce"] = "";

}
public ActionResult financeCurrencyConvert()
{
return View();
}
public ActionResult finance()
{
{
financeInit();
if (Request.Params["submitter"] == "Calculate")
financeCurrencyConvert();
return View();
}
}
}
}







<HTML>
<HEAD>
<TITLE>NZ Currency Converter</TITLE>
</HEAD>
<BODY>

<form name="Currency Converter" method="post" />
<tr>
<td>
<input type="radio" name="convert" value="Y" <%if (String.Compare((String) ViewData["convert"],"Y",false)==0) Response.Write("checked"); %> />Convert From NZD<br />
<input type="radio" name="convert" value="N" <%if (String.Compare((String) ViewData["convert"],"Y",false)==0) Response.Write("checked"); %> />Convert To NZD
</td>
</tr>
<p><tr>
<td colspan="2" align="right">&nbsp;&nbsp;The other currency is:</td>
<td>
<select name="exchrate">
<% List<Currency.Models.exchrate> exchrateList = (List <Currency.Models.exchrate>) ViewData["exchrateList"];
foreach (Currency.Models.exchrate st in exchrateList)
{
%>
<option value="<% Response.Write(st.othercurrency);%>">"<% Response.Write(st.fromnzd);%>">"<% Response.Write (st.tonzd);%>"> </option>

<% } %>
<option value=""></option>
</select>

</td>
</tr>
</p>
<p>
<tr><td colspan="2" align="right">&nbsp;&nbsp;You wish to convert: <input type="text" name="calculate" size="30" />
<input type="submit" name="submitter" value="calculate"onclick="return buttclick_confirm('calculate')"; />
</td>
</tr>
</p>
<p>
<tr><td colspan="2" align="right">&nbsp;&nbsp;That will produce:<input type="hidden" name="currency" </td></tr></p>
</form>
</BODY>
</HTML>
Reply With Quote
Reply

Bookmarks

Tags
asp.net chat, c sharp, html


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Submit button doesn't work on my webform katwright HTML/XHTML/XML 1 07-19-07 12:24 PM
how to disable browser's back button after logout shaky ASP 7 08-18-06 07:37 AM
How to make search engine to work? mhs12grade1992 PHP 1 02-16-05 04:50 PM
I have a visual basic problem I cannot solve. I need to hire someone to do this work chrismonroe10 Job Offers & Assistance 2 02-11-05 11:24 AM


All times are GMT -5. The time now is 02:48 PM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.