2013-07-15 3 views
0

kendodropdown을 가지고 있습니다. kendodropdown에서 선택한 값을 텍스트 상자로 채우고 싶습니다. 편집 버튼을 클릭하십시오. 나는 mvc.razor를 사용한다. 도와주세요. 이 시도 controller1/뷰 1Kendodropdown 값을 텍스트 상자

 @(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/뷰 2

<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" }) 
+1

지금까지 한 것을 보여줄 필요가 있습니다. 여기에 해결책을 묻는 것은 당신에게 의지 할 것입니다. 당신이 한 일을 보게하십시오. –

+0

응답을 보내 주셔서 감사합니다. 코드를 첨부했습니다. 제발 도와주세요. – gs11111

답변

0

,

@(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 is for ID    
       $("#CoutryID").data("kendoComboBox").text(); //This is for text    
     }); 

그래서 당신은 위의 코드를 기반에 값을 설정해야합니다.

관련 문제