Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

255
Visualizações
why is my input always showing me this data-val-required?

I have created a nullable corporateSponsorName. However, I am not able to have an empty value to my database.. when I tried console.log, it shows me "" which the actual code did not mention "data-val="true" data-val-required="The Corporate Sponsor Name* field is required.""

may i know how to turn off that data-val-required?

about 4 years ago · Santiago Gelvez
1 Respostas
Responde à pergunta

0

As this document said:

Beginning with .NET 6, new projects include the <Nullable>enable</Nullable> element in the project file. Once the feature is turned on, existing reference variable declarations become non-nullable reference types.

In .NET 6 the non-nullable property must be required.

To achieve your requirement, you can remove <Nullable>enable</Nullable> from your project file (Right-click on the project name in the Solution Explorer, and then select Edit Project File from the menu).

Another way is that you can add ? to allow nullable, e.g:

public class Test
{
    public string? Name { get; set; }
    public string? Id { get; set; }
    //other proerpties..
}

If you do not use .NET 6, it will not make property required by default unless you add [Required] attribute on the property.

about 4 years ago · Santiago Gelvez Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda