Freelance Project Requests Software Development in C# WPF Asp.Net Core Vba Excel Word SQL-Server EF Linq, UWP Net




How do you hide a field in an asp core input form?

How do you hide an ID field?


This form will hide the ID field.

In Asp.Net Core you can use the helper tag Input Type = "hidden"

<input type="hidden" asp-for="IDUser" />





This Razor Code example shows how to pass the field from a visible input field to an invisible field.

During a create operation, there is no automatic PrimaryKey ID available, since this is not created until it is created in SQL Server.

You can either leave the ID field completely off, or hide it.

@*Visible Asp Core Field*@

<div class="form-group">

    <input asp-for="IDUser" class="form-control" disabled />

    <span asp-validation-for="IDUser" class="text-danger"></span>



@*Hidden Asp Core Field*@

<input type="hidden" asp-for="IDUser" />



When returning the form, the null value may need to be automated when a data model is bound.

Asp.Net Core MVC: Form Get field values without model
Asp MVC: Large text box Input, Textarea, Div with HTML
Asp Core Mvc: Example of a Create Form
Asp Core: hide input field, hide ID field


Contact for Jobs, Project Requests: