Bootstrap X-Editables checklist source issue (C#)

23 views Asked by At

i am new here and new to .NET. I have been tinkering with Bootstrap X-Editables and with most of its input types, its been wonderful until i came across the checklist input. I am currently using Ajax to post the checked values to a web services (ASMX in C#). The only problem is, although it is posting an array, I am having nightmares trying to capture it on the ASMX web method. Here is my X-Editable code:

//make status editable
          $('#OfferingTypeAllocation').editable({
            type: 'select',
            title: 'Select status',
            placement: 'right',
            value: 2,
            source: [
              {value: 1, text: 'status 1'},
              {value: 2, text: 'status 2'},
              {value: 3, text: 'status 3'}
            ],
                
            // uncomment these lines to send data to the server
            pk: 1,
            url: '/Services/Passport.asmx/ProcessArray'
          });

and the payload looks like this:

name: OfferingTypeAllocation
value[]: 1
value[]: 2
value[]: 3
pk: 1
PassportId: 1

The following is a very basic method i wrote to capture the array:

[WebMethod]
        public void ProcessArray(int[] values)
        {
            // Process the array here
            foreach (int value in values)
            {
                Console.WriteLine(value);
            }
        }

This would show an error of NullReference. I tried many different ways to capture this array but i simply cannot get anything to work.

I would appreciate some advice from you good folks.

0

There are 0 answers