【问题标题】:Showing Description in a TextBox when selecting the correspodent ID on ComboBox在 ComboBox 上选择对应 ID 时在 TextBox 中显示说明
【发布时间】:2019-03-21 10:31:33
【问题描述】:

我正在尝试有一个文本框,当用户在 ComboBox 上选择相应的 id 时显示描述。或者在同一个 ComboBox 中显示 ID - 描述。

知道如何实现吗?

【问题讨论】:

    标签: telerik


    【解决方案1】:

    使用 Telerik 控件在下方查找

    C# 剃刀

    <div class="row">
        <div class="col-md-8">
            @(Html.Kendo().DropDownList()
                             .Name("color")
                             .DataTextField("Text")
                             .DataValueField("Value")
                             .Events(e => e.Change("change"))
                             .BindTo(new List<SelectListItem>() {
              new SelectListItem() {
                  Text = "Black",
                  Value = "1"
              },
              new SelectListItem() {
                  Text = "Orange",
                  Value = "2"
              },
              new SelectListItem() {
                  Text = "Grey",
                  Value = "3"
              }
                             })
                             .Value("1")
                             .HtmlAttributes(new { style = "width: 100%" })
            )
        </div>
    
    <div class="col-md-4">
            @Html.Kendo().TextBox().Name("txtColor")
        </div>
    </div>
    

    脚本

    <script>
        function change() {
            $("#txtColor").val($("#color").val());
        }
    </script>
    

    【讨论】:

      猜你喜欢
      • 2017-05-28
      • 1970-01-01
      • 2018-03-13
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-11-05
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多