mardi 26 octobre 2021

Passing List String from C# to Javasvript

I am currently trying to check if a value of a string variable is "Apple". Now I need to pass a list of fruits to javascript from C#.

C# Code

List<String> fruits = new List<String>{"Apple","Mango","Orange"}

JavaScript Code

$(document).on('click','#dvAppContent input:checkbox[id*=chkfunction]', function () {
   ToggleApplication(this);
});

function ToggleApplication(currentFunction) {
   var fruitName = $(currentFunction).closest('ui').parent('label').text().trim();    
   If(fruitName == "Apple")
   {
     return true;
   }       
}



Aucun commentaire:

Enregistrer un commentaire