Hi Andrew,
Thank you for contacting Syncfusion support.
Yes, we can pass the selected item in ListBox to controller page using Ajax post from the client side script. Define the script using AJAX post under the ListBox’s “Selected” client side event. In the controller post action we can get the data passed through the AJAX post. Please refer the code snippet below,
<code>
[CSHTML]
@Html.EJ().ListBox("list1").TargetID("carsList").ClientSideEvents(e=>e.SelectIndexChanged("onSelected"))[Script]
<script type="text/javascript">
function onSelected(args) {
litem = args.data.selectedText; // selected item text
$.ajax({
type: "POST",
url: "ListBoxFeatures",
content: "application/json; charset=utf-8",
dataType: "json",
data: { selectedtext: litem },
complete: function (d) {
$("#mydata").text(litem);
}
});
}
</script>
[Controller]
//Post action to get the data passed from AJAX post
[HttpPost]
public ActionResult ListBoxFeatures(string selectedtext)
{
string Listboxitem = selectedtext;
return View();
}
</code>
Simple sample prepared can be downloaded from the link below:
http://www.syncfusion.com/downloads/support/forum/118978/ListBox_f118978_(2)-1621988663.zip
Please let us know if you have any other queries.
Regards,
Ezhil S