Hi muhammad12,
Please refer below sample.
Controller
public class HomeController : Controller
{
// GET: Home
public ActionResult Index()
{
return View();
}
[HttpPost]
public ActionResult Index(string name)
{
ViewBag.Id = name + DateTime.Now.ToString("HHmmss");
return View();
}
}
View
@{
Layout = null;
}
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width" />
<title>Index</title>
</head>
<body>
@using (Html.BeginForm("Index", "Home", FormMethod.Post))
{
<input type="text" name="name" />
<input type="submit" value="Submit" />
}
<hr />
@ViewBag.Id
</body>
</html>
Screenshot