gs11111
gs11111

Reputation: 659

Give input to kendodropdown list

I have this dropdown list:

>  @(Html.Kendo().DropDownList()
>   .Name("labeldropdown")
>   .DataTextField("state")
>    .DataValueField("ID")
>    .OptionLabel("Select label")
>    .AutoBind(true)
>   .HtmlAttributes(new { @style = "width: 72px;font-size:12px; " })
>   .DataSource(source =>
>    {
>       source.Read(read =>
>         {
>     read.Action("bindstate", "controller");
>        });
>      })
>        .SelectedIndex(0)
>            )

I have a edit button. If i click that, I want to populate the currently selected value from kendodropdown to populate in it and save the changes to the dropdown list.

Upvotes: 0

Views: 60

Answers (1)

Matt Millican
Matt Millican

Reputation: 4054

I believe you're asking how to get the selected value from the DropDownList. If so, you would do something like this:

$('#my-button').on('click', function(){
    var dropdown = $('#my-dropdown').data('kendoDropDownList');
    var selValue = dropdown.value()
}

Upvotes: 2

Related Questions