Monday, 16 September 2013

Jquery from forward to another page with parameters and getting those value in viewbag


document.location.href = '../Home/CollegeSearch?state=' + state + '&districtId=' + distId + '&universityId=' + universityId + '&departmentId=' + departmentId;


  public ActionResult CollegeSearch(string state, string districtId, string universityId, string departmentId)
        {

           
            ViewBag.state = state;
            ViewBag.districtId = districtId;
           // ViewBag.universityTypeId = universityTypeId;
            ViewBag.universityId = universityId;
            ViewBag.departmentId = departmentId;
           
            return View();
        }



  $(document).ready(function () {//1
        var state = '@ViewBag.state';
        var districtId = '@ViewBag.districtId';       
        var UniversityId = '@ViewBag.universityId';
        var deptId = '@ViewBag.departmentId';
});

No comments:

Post a Comment