Click here to Skip to main content
13,152,454 members (37,095 online)
Rate this:
Please Sign up or sign in to vote.
See more:
I want to pass the selected value of dropdown list to controller.

The drop down in view is as follows;

    <label>Page Size</label>
    @Html.DropDownList("pageSizes", HRMS.Areas.EIM.Controllers.RouteController.PageSizeSelectList(), new { onchange = "onPageSizeChange()" }) rows per page    


capture the change event value as follows;

    $(function onPageSizeChange() {
        $('#pageSizes').change(function () {
            var selectedValue = $(this).val();
            $.post("/Route/SaveEntry", selectedValue); 

How to pass this selected value to controller??Please help me.
Posted 12-Sep-12 22:08pm
vyas_pratik20 13-Sep-12 5:43am
you want to submit the page or you want to send it using ajax request.

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 2

If this Helps:

$(function() {    
$("#submit").click(function () 
	$.ajax	({             
		url: this.href,            
 		type: 'POST',             
		data: { input: $('#dropdown').val() },
                success: function (result) {   alert(;   },       
		error: function () { alert("error");    }        
   	return false;     
public ActionResult submit(string input) 
	var result = _db.Ingredients.Where(i => i.IngredientName == input); 
  	return Json(new { name = "Hello There" }); 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy |
Web03 | 2.8.170924.2 | Last Updated 13 Sep 2012
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100