テキストボックスを持つ小さなWebページがあり、入力として数値のみを使用したい. C#側でそれを行うにはどうすればよいですか。私を助けてください!if(userId = xxx !numbers)
数字を入力してくださいというメッセージを残してくださいというifステートメントが必要だと思っていました。私はそれを理解できませんでした。
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
namespace AlexUsers.Controllers
{
public class HomeController : Controller
{
//
// GET: /Home/
public ActionResult Index()
{
string userId = Request["UserId"];
return View();
}
}
}
<%@ Page Language="C#" Inherits="System.Web.Mvc.ViewPage<dynamic>" %>
<!DOCTYPE html>
<html>
<head runat="server">
<title>Search</title>
</head>
<div align="center">
<form id="searchUser" method="post" action="">
<table align="center">
<tr>
<td class="label">
Enter ID:
</td>
<td>
<input type="text" name="UserId" id="UserId" />
</td>
</tr>
<tr>
<td>
<button class="searchButton" id="searchButtong">Search</button>
</td>
</tr>
</table>
</form>
</div>
<hr />
</html>