1

I have a MVC3 view with the following code

$(document).ready(function () {
    $('#multiInlinePicker').datepick({
        multiSelect: 30, monthsToShow: 3, monthsToStep: 3,
        prevText: 'Prev months', nextText: 'Next months'
    });
   }

 <span id="multiInlinePicker"></span>

I would like to pass the selected dates on the datepick control to the controller. What is the best way to do this?

Thanks in advance Regards Tom

1 Answer 1

2

use onselect

$('#multiInlinePicker').datepick({
    multiSelect: 30, monthsToShow: 3, monthsToStep: 3,
    prevText: 'Prev months', 
    nextText: 'Next months',
    onSelect:function(date){ 
        //UPDATED
        $.ajax({
           url: 'url to your controller action',
           data:'selecteddate=' + date,
           type:'post',
           success:function(response){
              alert(reponse);
           }
        })

      }
});

NOTE: these calls your controllers action method everytime the date on datepicker is selected.. so make suure if u need that..

Sign up to request clarification or add additional context in comments.

2 Comments

I can use this but I would like to pass the selected dates to the action method of the controller.
then use ajax() which points to the controller action method with a data (i.e date)...inside the onSelect option...

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.