Sorry if this is a silly question.
But I’ve been struggling with this for a while. I want to check if a MultiSelectlist I have contains a particular value. What is the best way to do this? I tried using the contains() function, but it doesn’t like it.
Thank you in advance for your help
Apologies for not having done this earlier. New to SO, what can I say!
I wrote the following script to get the values in the MultiSelectList into an array and post it to an action method using Ajax. I then used the Array.Exists() method in the View to check if the string is in the array or not.
Ajax call:
And in my View, I have the following function (it takes an int, rather than a string)
HTH