Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

254
Views
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 answers
Answer question

0

use @if to test values in Model

@if (Model.AssessmentDetailByCategChart!= null) 
{
about 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!