asp.net - Kendodropdown value to textbox -


i have kendodropdown, want populate selected value kendodropdown textbox ater clicking edit button. use mvc.razor. please help. controller1/view1

     @(html.kendo().dropdownlist()       .name("labeldropdown")       .datatextfield("tasks")         .datavaluefield("id")           .optionlabel("select label")          .autobind(true)      .htmlattributes(new { @style = "width: 72px;font-size:12px; " })         .datasource(source =>    {   source.read(read =>           {           read.action("bindstates", "resource");        });         })         .selectedindex(0)       )  <input type="button" value="new" class="k-button" id="newlabel" />   <input type="button" value="edit" class="k-button" id="editlabel" /> 

controller1/view2

 <input type="button" value="ok" class="k-button" id="labelok" /><br />   <input type="button" value="cancel" class="k-button" id="labelcancel" />   @html.textbox("labeltxt", null, new { @class = "k-textbox" }) 

try this,

@(html.kendo().dropdownlist()       .name("labeldropdown")       .datatextfield("tasks")         .datavaluefield("id")           .optionlabel("select label")          .autobind(true)      .htmlattributes(new { @style = "width: 72px;font-size:12px; " })         .datasource(source =>    {   source.read(read =>           {           read.action("bindstates", "resource");        });         })         .selectedindex(0)       )        @html.textbox("labeltxt", null, new {id = "txttext", @class = "k-textbox" })      <input type="button" value="edit" class="k-button" id="editlabel" />          $("#editlabel").click(function () {                $("#txttext").val($("#labeldropdown").data("kendocombobox").value());               $("#coutryid").data("kendocombobox").value();//this id                              $("#coutryid").data("kendocombobox").text();  //this text                      }); 

so have set value on based on above code.


Comments