We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Pass selected date to Controller

Hi Team,

Could you please help me to pass selected date of datepicker and  selected value of dropdownlist from View to Controller?



Thanks,

1 Reply

DL Deepa Loganathan Syncfusion Team December 4, 2018 10:48 AM UTC

Dear Customer,  
 
 
Thanks for contacting Syncfusion support.  
 
 
You can pass the selected Date and the Value from Dropdownlist to the controller in the post action of the form, where the posted values can be accessed in the controller as given in the below code. 
 
 
 
[HttpPost] 
        public ActionResult Index(DateTimePickerModel model) 
        { 
            //posted value is obtained from the model 
            ViewBag.country = new Country().CountryList(); 
            datetimepicker.objectValue = model.objectValue; //Datepicker 
            datetimepicker.CountryId = model.CountryId; //Droprdownlist 
 
            return View(datetimepicker); 
        } 
 
 
 
We have prepared a sample based on your requirement. Please check the below link.  
 
 
 
 
Please get back to us if you have any further queries. 
 
 
Regards,  
 
Deepa L. 


Loader.
Live Chat Icon For mobile
Up arrow icon