|
[HttpPost]
public ActionResult Index(string[] selectCar)
{
string value = string.Join(",", selectCar); ;
return RedirectToAction("DropdownlistFeatures", "Dropdownlist", new { ddlVal = value });
} |
|
public ActionResult DropdownlistFeatures(string selectCar)
{
string q = Request.QueryString["ddlVal"];
ViewBag.value = q;
return View();
} |
|
@Html.EJ().DropDownList("selectCar").TargetID("carsList").ShowCheckbox().Width("150px").Value(ViewBag.value) |
Hi Shalini,Thank you for using Syncfusion products.The EnablePersistance property will maintain selected values only on the same page. To set the same values for the controls across in different page, you need to pass the selected value from one view to another. Kindly refer to the following code.
[HttpPost]public ActionResult Index(string[] selectCar){string value = string.Join(",", selectCar); ;return RedirectToAction("DropdownlistFeatures", "Dropdownlist", new { ddlVal = value });}
Access the selected value in the controller and pass the selected value to the other view.
public ActionResult DropdownlistFeatures(string selectCar){string q = Request.QueryString["ddlVal"];ViewBag.value = q;return View();}
Access the value in the second view and return it to the control using ViewBag data.
@Html.EJ().DropDownList("selectCar").TargetID("carsList").ShowCheckbox().Width("150px").Value(ViewBag.value)
We have prepared a simple sample for your requirement, please find the sample at the following location: http://www.syncfusion.com/downloads/support/forum/135882/ze/ddlpassSelected-1000374836
Regards,Prince
|
<div ng-app="dropdownlistApp" ng-controller="dropdownlistCtrl">
<form novalidate>
<input id="dropdown1" ej-dropdownlist e-targetID="carsList" e-value="value" e-showcheckbox=true e-width="width" />
</form>
</div>
<script>
var item = "@ViewBag.value"; // receive the values from ViewBag here
angular.module('dropdownlistApp', ['ejangular']).controller('dropdownlistCtrl', function ($scope) {
$scope.value = item;
$scope.width = "150px";
});
</script> |