I want to build in C# a form, which has as input a day, month and year.
This is what I have so far, the form works, but the input isn't showed on the next page.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
namespace WebApplication3.Controllers
{
public class VerwerkController : Controller
{
// GET: Verwerk
public ActionResult Index()
{
return View();
}
public ActionResult Verwerk(int dag, String maand, int jaar)
{
int day = dag;
String month = maand;
int year = jaar;
return View(day + "/" + month + "/" + year);
}
}
}
This is VerwerkController.cs and the code below is Index.cshtml (View).
@{
Layout = null;
}
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width" />
<title>Index</title>
</head>
<body>
<div>
<form name="input" action="/home/verwerk" method="post" >
Dag: <input type="number" name="dag" /><br />
Maand: <input type="text" name="maand" /><br />
Jaar: <input type="number" name="jaar" /><br />
<input type="submit" name="send" /><br />
</form>
</div>
</body>
</html>
Just started with C# and I don't get this working, anyone a solution?
Aucun commentaire:
Enregistrer un commentaire