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

How can i find out what was selected in a list box in asp mvc

is there any documentation on this i cant seem to find anything.
here is the code of my view so far

@model List<BusinessLayer.Employee>

    @Html.EJ().ListBox("list1").Datasource(Model).ClientSideEvents(e => { e.SelectIndexChanged("selected"); })
    <p id="demo">JavaScript can change HTML content.</p>
    <script type="text/javascript">
        function selected(args)
            document.getElementById('demo').innerHTML = "selecteditemtext"

eventually i want to filter a grid based on the item selected or return the selected item to the controller.


3 Replies

ES Ezhil S Syncfusion Team May 1, 2015 06:13 PM UTC

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,

<script type="text/javascript">

function onSelected(args) {

litem = args.data.selectedText; // selected item text


type: "POST",

url: "ListBoxFeatures",

content: "application/json; charset=utf-8",

dataType: "json",

data: { selectedtext: litem },

complete: function (d) {





//Post action to get the data passed from AJAX post


public ActionResult ListBoxFeatures(string selectedtext)


string Listboxitem = selectedtext;

return View();

Simple sample prepared can be downloaded from the link below:

Please let us know if you have any other queries.

Ezhil S

AS Andrew Simpson May 5, 2015 08:33 AM UTC

Thank You.
Thats just what i needed.

KC Kasithangam C Syncfusion Team May 6, 2015 04:52 AM UTC

Hi Andrew,

Thanks for your update. Please let us know if you have further queries. We will be happy to help you out.


Live Chat Icon For mobile
Up arrow icon