Сообщество IT-специалистов
Ответы на любые вопросы об IT
Профессиональное развитие в IT
Удаленная работа для IT-специалистов
@page @model WebApplication1.Pages.CreateModel @{ if (Request.Method == "POST") { <p>Request.Form["test"]</p> } } <div> <input type="text" name="test" value=""/> </div>
@{ if (IsPost) { string companyname = Request.Form["companyname"]; string contactname = Request.Form["contactname"]; int employeecount = Request.Form["employees"].AsInt(); <text> You entered: <br /> Company Name: @companyname <br /> Contact Name: @contactname <br /> Employee Count: @employeecount <br /> </text> } }
<!DOCTYPE html> <html> <head> <title>Customer Form</title> </head> <body> <form method="post" > <fieldset> <legend>Add Customer</legend> <div> <label for="CompanyName">Company Name:</label> <input type="text" name="CompanyName" value="" /> </div> <div> <label for="ContactName">Contact Name:</label> <input type="text" name="ContactName" value="" /> </div> <div> <label for="Employees">Employee Count:</label> <input type="text" name="Employees" value="" /> </div> <div> <label> </label> <input type="submit" value="Submit" class="submit" /> </div> </fieldset> </form> </body> </html>
@page @model WebApplication1.Pages.CreateModel @{ string text = ""; if (Request.Method == "GET") { text = Request.Form["test"]; } } <div> <input type="text" name="test" value=""/> <p>@text</p> </div>
@page @model WebApplication1.Pages.CreateModel @{ if (Request.Method == "POST") { string text = Request.Form["test"]; <text> You entered: @text </text> } } <head> <title>Customer Form</title> </head> <body> <form method="post" > <fieldset> <div> <input type="text" value="" name="test"/> </div> <div> <label> </label> <input type="submit" value="Submit" class="submit" /> </div> </fieldset> </form> </body>