JustPaste
HomeCategoriesAboutDonateContactTerms of UsePrivacy Policy
JustPaste

Free online notepad — write and share instantly

Navigate

  • Home
  • Timeline
  • Categories

Info

  • About
  • Donate
  • Contact

Legal

  • Terms of Use
  • Privacy Policy

© 2026 JustPaste.app. All rights reserved.

Made with ♥ by JustPaste

Code | JustPaste.app
about 2 months ago0 views
👨‍💻Programming

Code

cd Desktop

dotnet new webapp -o daksh

cd daksh

code .

dotnet watch run

@page
@model RegisterModel

<h2>Simple Form</h2>

<form method="post">
    Name:
    <input type="text" name="Name" value="@Model.Name" />
    <br /><br />

    Age:
    <input type="text" name="Age" value="@Model.Age" />
    <br /><br />

    <button type="submit">Submit</button>
</form>

@if (Model.Message != null)
{
    <p>@Model.Message</p>
}

using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.RazorPages;

public class RegisterModel : PageModel
{
    [BindProperty]
    public string Name { get; set; }

    [BindProperty]
    public string Age { get; set; }

    public string Message { get; set; }

    public void OnPost()
    {
        Message = "Hello " + Name + ", Age: " + Age;
    }
}
← Back to timeline