This is a migrated thread and some comments may be shown as answers.

Get values from telerik multiselect in C# instead of javascript

1 Answer 240 Views
MultiSelect
This is a migrated thread and some comments may be shown as answers.
Ric
Top achievements
Rank 1
Ric asked on 03 Sep 2015, 10:53 AM
I have the following multi select from telerik on my asp.net mvc project
<div class="demo-section user-selection">
    <h3 class="title">Select customers</h3>
        @(Html.Kendo().MultiSelect()
      .Name("customers")
      .DataTextField("givenName")
      .DataValueField("description")
      .Placeholder("No users selected")
      .Events(events => events.Change("TestFunc"))
      .DataSource(source =>
      {
          source.Read(read =>
          {
              read.Action("GetCustomers", "Home");
          });
      })
      .Height(300)
                //.HtmlAttributes(new { style = "width: 400px" })
                      .HeaderTemplate("
    <div class=\"dropdown-header\">" +
                            "
        <span class=\"k-widget k-header\">Photo</span>" +
                            "
        <span class=\"k-widget k-header\">Contact info</span>" +
                        "
    </div>")
                              .ItemTemplate("
    <span class=\"k-state-default\">
        <img class=\"userPhoto\" src=\"" + Url.Content("http://yarris.design/images/userCentered.png") + "\" />
    </span>" +
                                        "
    <span class=\"k-state-default\">
        <h3>#: data.givenName #</h3>
        <p>#: data.description #</p>
    </span>")
                              .TagTemplate("
    <img class=\"tag-image\" src=\"" + Url.Content("http://yarris.design/images/userCentered.png") + "\" alt=\"\" />" +
                                  "#: data.givenName #")
        )
     
</div>

Everytime someone is selected i want to do some operations, right now im reading the selected with this javascript

 

function TestFunc() {
 
var multiselect = $("#customers").data("kendoMultiSelect");
 
// get data items for the selected options.
var dataItem = multiselect.dataItems();
console.log(dataItem);
 
}

I would like to know how can i read it in my HomeController.cs instead.

1 Answer, 1 is accepted

Sort by
0
Kiril Nikolov
Telerik team
answered on 07 Sep 2015, 06:13 AM

Hello Ric,

 

Kendo UI is a exclusively a client side framework. Even though it offers the MVC wrappers, it runs on the client, therefore there are not server events or methods that you can use for this requirements. 

 

Regards,
Kiril Nikolov
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
Tags
MultiSelect
Asked by
Ric
Top achievements
Rank 1
Answers by
Kiril Nikolov
Telerik team
Share this question
or