Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

255
Vistas
MVC and Javascript to test for a null value in javascript

I am using MVC .net core to populate my ViewModel. I am trying to build a chart and a canvas is not being created if the value is null. This is working fine.

regardless if I add a test in the script section to test for null

if (Model.AssessmentDetailByCategChart!= null) 
{

or testing for element exists (and it should not )

if ($('#canvasRadarTech').length > 0) {

I have this crash. Could you please help with the proper syntax?

enter image description here

enter image description here

If I add a "@" in front of the model, then the rest of the code is not compiling. enter image description here

about 4 years ago · Santiago Trujillo
1 Respuestas
Responde la pregunta

0

use @if to test values in Model

@if (Model.AssessmentDetailByCategChart!= null) 
{
about 4 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda