0
當有人在文本框中輸入一個數字時,我需要鏈接到數據庫(點擊率),然後點擊計算,它會從數據庫中提取費率,並在下面顯示計算結果'表單信息'。我應該在家庭控制器/索引中將代碼鏈接到數據庫?按下計算按鈕 - 從數據庫中檢索費率
的Index.aspx:
<td>You wish to convert:
<input type="text" name="amount" size="30" onblur="test_ifinteger(Index.amount,'amounts')"/>
<input type="submit" name="submitter" value="calculate" />
<tr><td colspan="2">That will produce:<%=ViewData["formmessage"] %></td></tr>
首頁控制器:
public ActionResult Index()
{
financeInit();
if (Request.Params["submitter"] == "calculate")
calculatepressed();
return View();
public void calculatepressed()
{
.............
}