Passing current DropDown as parameter

2 posts, 0 answers
  1. Ezequiel
    Ezequiel avatar
    36 posts
    Member since:
    Oct 2011

    Posted 10 Jul 2015 Link to this post


    I have a EditorTemplate which is:

    @model string
        .HtmlAttributes(new { style = "width: 220px;"})
            .DataSource(ds => ds.Read(read => read.Action("GetList", "Combo").Data("getAdditionalParam")))

    I want to get this dropdown in my function:

    function getAdditionalParam(dropDown){
    //do stuff with dropDown


     return { additionParam: 1 }


    Is there anyway to pass the object itself as parameter?




  2. Georgi Krustev
    Georgi Krustev avatar
    3725 posts

    Posted 14 Jul 2015 Link to this post

    Hello Ezequiel,

    Basically, you will need to get an instance of the widget in the getAdditionalParam function. The code should look something like that:
    function getAdditionalParam(e){
    var id = "#@(ViewData.TemplateInfo.GetFullHtmlFieldName(string.Empty))";
    var widget = $(id).data("kendoDropDownList");
    //get widget value
    var value = widget.value();
    //get the selected data item
    var dataItem = widget.dataItem();
     return { additionParam: 1, item: dataItem }

    If you would like to pass an object then you can just add it to the object. Note that ASP.NET MVC is responsible for parsing this object and you need to configure the Action method correctly in order to receive it correctly populated.

    Georgi Krustev
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Back to Top